@newrelic/browser-agent 1.321.0 → 1.322.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/util/console.js +3 -0
- package/dist/cjs/common/v2/manifest.js +142 -0
- package/dist/cjs/common/v2/script-tracker-types.js +27 -0
- package/dist/cjs/common/v2/script-tracker.js +223 -25
- package/dist/cjs/common/v2/utils.js +47 -1
- package/dist/cjs/common/vitals/cumulative-layout-shift.js +6 -4
- package/dist/cjs/common/vitals/first-contentful-paint.js +5 -3
- package/dist/cjs/common/vitals/interaction-to-next-paint.js +10 -4
- package/dist/cjs/common/vitals/largest-contentful-paint.js +5 -3
- package/dist/cjs/common/vitals/register-vital.js +25 -0
- package/dist/cjs/common/vitals/time-to-first-byte.js +4 -2
- package/dist/cjs/common/vitals/vital-metric.js +3 -2
- package/dist/cjs/features/generic_events/aggregate/index.js +31 -14
- package/dist/cjs/features/generic_events/instrument/index.js +41 -1
- package/dist/cjs/interfaces/registered-iframe-entity.js +9 -3
- package/dist/cjs/loaders/api/register-api-types.js +13 -4
- package/dist/cjs/loaders/api/register.js +34 -1
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/util/console.js +3 -0
- package/dist/esm/common/v2/manifest.js +136 -0
- package/dist/esm/common/v2/script-tracker-types.js +24 -0
- package/dist/esm/common/v2/script-tracker.js +222 -26
- package/dist/esm/common/v2/utils.js +46 -1
- package/dist/esm/common/vitals/cumulative-layout-shift.js +6 -4
- package/dist/esm/common/vitals/first-contentful-paint.js +5 -3
- package/dist/esm/common/vitals/interaction-to-next-paint.js +10 -4
- package/dist/esm/common/vitals/largest-contentful-paint.js +5 -3
- package/dist/esm/common/vitals/register-vital.js +19 -0
- package/dist/esm/common/vitals/time-to-first-byte.js +4 -2
- package/dist/esm/common/vitals/vital-metric.js +3 -2
- package/dist/esm/features/generic_events/aggregate/index.js +32 -15
- package/dist/esm/features/generic_events/instrument/index.js +41 -1
- package/dist/esm/interfaces/registered-iframe-entity.js +9 -3
- package/dist/esm/loaders/api/register-api-types.js +14 -4
- package/dist/esm/loaders/api/register.js +34 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/common/config/init-types.d.ts +1 -1
- package/dist/types/common/util/console.d.ts +3 -0
- package/dist/types/common/util/console.d.ts.map +1 -1
- package/dist/types/common/v2/manifest.d.ts +66 -0
- package/dist/types/common/v2/manifest.d.ts.map +1 -0
- package/dist/types/common/v2/script-tracker-types.d.ts +25 -0
- package/dist/types/common/v2/script-tracker-types.d.ts.map +1 -0
- package/dist/types/common/v2/script-tracker.d.ts +25 -4
- package/dist/types/common/v2/script-tracker.d.ts.map +1 -1
- package/dist/types/common/v2/utils.d.ts +12 -0
- package/dist/types/common/v2/utils.d.ts.map +1 -1
- package/dist/types/common/vitals/cumulative-layout-shift.d.ts.map +1 -1
- package/dist/types/common/vitals/first-contentful-paint.d.ts.map +1 -1
- package/dist/types/common/vitals/interaction-to-next-paint.d.ts.map +1 -1
- package/dist/types/common/vitals/largest-contentful-paint.d.ts.map +1 -1
- package/dist/types/common/vitals/register-vital.d.ts +13 -0
- package/dist/types/common/vitals/register-vital.d.ts.map +1 -0
- package/dist/types/common/vitals/time-to-first-byte.d.ts.map +1 -1
- package/dist/types/common/vitals/vital-metric.d.ts +1 -1
- package/dist/types/common/vitals/vital-metric.d.ts.map +1 -1
- package/dist/types/features/generic_events/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/generic_events/instrument/index.d.ts.map +1 -1
- package/dist/types/interfaces/registered-iframe-entity.d.ts.map +1 -1
- package/dist/types/loaders/api/register-api-types.d.ts +31 -4
- package/dist/types/loaders/api/register-api-types.d.ts.map +1 -1
- package/dist/types/loaders/api/register.d.ts +3 -0
- package/dist/types/loaders/api/register.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/common/util/console.js +3 -0
- package/src/common/v2/manifest.js +126 -0
- package/src/common/v2/script-tracker-types.js +24 -0
- package/src/common/v2/script-tracker.js +218 -26
- package/src/common/v2/utils.js +42 -1
- package/src/common/vitals/cumulative-layout-shift.js +5 -3
- package/src/common/vitals/first-contentful-paint.js +5 -3
- package/src/common/vitals/interaction-to-next-paint.js +8 -3
- package/src/common/vitals/largest-contentful-paint.js +5 -3
- package/src/common/vitals/register-vital.js +19 -0
- package/src/common/vitals/time-to-first-byte.js +4 -2
- package/src/common/vitals/vital-metric.js +3 -2
- package/src/features/generic_events/aggregate/index.js +25 -15
- package/src/features/generic_events/instrument/index.js +39 -1
- package/src/interfaces/registered-iframe-entity.js +7 -2
- package/src/loaders/api/register-api-types.js +14 -4
- package/src/loaders/api/register.js +29 -2
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { globalScope, isBrowserScope } from '../../../common/constants/runtime';
|
|
7
7
|
import { handle } from '../../../common/event-emitter/handle';
|
|
8
8
|
import { eventListenerOpts, windowAddEventListener } from '../../../common/event-listener/event-listener-opts';
|
|
9
|
+
import { now } from '../../../common/timing/now';
|
|
9
10
|
import { debounce } from '../../../common/util/invoke';
|
|
10
11
|
import { setupAddPageActionAPI } from '../../../loaders/api/addPageAction';
|
|
11
12
|
import { setupFinishedAPI } from '../../../loaders/api/finished';
|
|
@@ -51,8 +52,26 @@ export class Instrument extends InstrumentBase {
|
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
if (securityPolicyViolationEnabled) {
|
|
55
|
+
/** ReportingObserver's `csp-violation` type isn't reliably enabled everywhere out of the box:
|
|
56
|
+
* - Safari only delivers it when the page sets a report-to CSP directive -- https://bugs.webkit.org/show_bug.cgi?id=320750;
|
|
57
|
+
* - Firefox ships it behind the `dom.reporting.enabled` pref, which defaults to false;
|
|
58
|
+
* So it's only used for violations that occur before the agent loaded, targeting Chromium browsers. `buffered: true` replays
|
|
59
|
+
* that backlog in the observer's first callback invocation, after which it's disconnected and all future violations are
|
|
60
|
+
* covered by securitypolicyviolation, which is reliable across all browsers. */
|
|
61
|
+
if (typeof globalScope.ReportingObserver === 'function') {
|
|
62
|
+
const cspObserver = new globalScope.ReportingObserver(reports => {
|
|
63
|
+
reports.forEach(report => {
|
|
64
|
+
handle('spv', [normalizeCspViolation(report), now()], undefined, FEATURE_NAMES.genericEvents, this.ee);
|
|
65
|
+
});
|
|
66
|
+
cspObserver.disconnect();
|
|
67
|
+
}, {
|
|
68
|
+
types: ['csp-violation'],
|
|
69
|
+
buffered: true
|
|
70
|
+
});
|
|
71
|
+
cspObserver.observe();
|
|
72
|
+
}
|
|
54
73
|
globalScope.addEventListener('securitypolicyviolation', evt => {
|
|
55
|
-
handle('spv', [evt], undefined, FEATURE_NAMES.genericEvents, this.ee);
|
|
74
|
+
handle('spv', [normalizeCspViolation(evt), evt.timeStamp], undefined, FEATURE_NAMES.genericEvents, this.ee);
|
|
56
75
|
}, eventListenerOpts(false, this.removeOnAbort.signal));
|
|
57
76
|
}
|
|
58
77
|
if (isBrowserScope) {
|
|
@@ -117,4 +136,25 @@ export class Instrument extends InstrumentBase {
|
|
|
117
136
|
if (genericEventSourceConfigs.some(x => x)) this.importAggregator(agentRef, () => import(/* webpackChunkName: "generic_events-aggregate" */'../aggregate'));else this.deregisterDrain();
|
|
118
137
|
}
|
|
119
138
|
}
|
|
139
|
+
/** `Report.body` (ReportingObserver) and `SecurityPolicyViolationEvent` (securitypolicyviolation) describe the same
|
|
140
|
+
* violation with differently-named/shaped fields -- collapse both into one shape so downstream code doesn't care
|
|
141
|
+
* which mechanism produced it. `source` is either of those: a Report (fields under `.body`, URLs as blockedURL/
|
|
142
|
+
* documentURL) or the event (fields at the top level, URLs as blockedURI/documentURI). Also normalizes disposition's
|
|
143
|
+
* "reporting" (Report body) to "report" (event) so the value is consistent regardless of source. */
|
|
144
|
+
function normalizeCspViolation(source) {
|
|
145
|
+
const body = source.body ?? source;
|
|
146
|
+
return {
|
|
147
|
+
blockedUrl: body.blockedURL ?? source.blockedURI,
|
|
148
|
+
documentUrl: body.documentURL ?? source.documentURI,
|
|
149
|
+
effectiveDirective: body.effectiveDirective,
|
|
150
|
+
originalPolicy: body.originalPolicy,
|
|
151
|
+
sourceFile: body.sourceFile,
|
|
152
|
+
statusCode: body.statusCode,
|
|
153
|
+
lineNumber: body.lineNumber,
|
|
154
|
+
columnNumber: body.columnNumber,
|
|
155
|
+
disposition: body.disposition === 'reporting' ? 'report' : body.disposition,
|
|
156
|
+
sample: body.sample,
|
|
157
|
+
referrer: body.referrer
|
|
158
|
+
};
|
|
159
|
+
}
|
|
120
160
|
export const GenericEvents = Instrument;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { onCLS, onFCP, onINP, onLCP } from 'web-vitals';
|
|
8
8
|
// internal
|
|
9
9
|
import { globalScope, isBrowserScope } from '../common/constants/runtime';
|
|
10
|
+
import { registerVital } from '../common/vitals/register-vital';
|
|
10
11
|
import { isIFrameWindow } from '../common/dom/iframe';
|
|
11
12
|
import { now } from '../common/timing/now';
|
|
12
13
|
import { warn } from '../common/util/console';
|
|
@@ -183,9 +184,14 @@ export class RegisteredIframeEntity {
|
|
|
183
184
|
*/
|
|
184
185
|
#setupVitalsListeners() {
|
|
185
186
|
VITALS.forEach(([vitalFn, property]) => {
|
|
186
|
-
vitalFn(({
|
|
187
|
-
value
|
|
187
|
+
registerVital(() => vitalFn(({
|
|
188
|
+
value,
|
|
189
|
+
entries: vitalEntries
|
|
188
190
|
}) => {
|
|
191
|
+
/* web-vitals v6 reports a synthetic INP (value 8, no entries) after bfcache restores when
|
|
192
|
+
every interaction stayed below the duration threshold; skip those so only measured
|
|
193
|
+
interactions are reported, matching the guard in src/common/vitals/interaction-to-next-paint.js */
|
|
194
|
+
if (property === 'inp' && !vitalEntries?.length) return;
|
|
189
195
|
this.metadata.vitals[property].value = value;
|
|
190
196
|
this.#postMessageToParent(IFRAME_VITALS_UPDATE, {
|
|
191
197
|
entries: [{
|
|
@@ -195,7 +201,7 @@ export class RegisteredIframeEntity {
|
|
|
195
201
|
});
|
|
196
202
|
}, {
|
|
197
203
|
reportAllChanges: property === 'cls' || property === 'inp'
|
|
198
|
-
});
|
|
204
|
+
}));
|
|
199
205
|
});
|
|
200
206
|
}
|
|
201
207
|
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
* @property {RegisterAPIMetadata} metadata - The metadata object containing the custom attributes and target information for the registered entity.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {import('../../common/v2/manifest').AssetFile} AssetFile
|
|
22
|
+
*/
|
|
23
|
+
|
|
20
24
|
/**
|
|
21
25
|
* @typedef {Object} RegisterAPIConstructor
|
|
22
26
|
* @property {string} id - The unique id for the registered entity. This will be assigned to any synthesized entities.
|
|
@@ -24,6 +28,8 @@
|
|
|
24
28
|
* @property {{[key: string]: any}} [tags] - The tags for the registered entity as key-value pairs. This will be assigned to any synthesized entities. Tags are converted to source.* attributes (e.g., {environment: 'production'} becomes source.environment: 'production').
|
|
25
29
|
* @property {RegisterAPITarget} [parent] - The parent target for the registered entity. If none was supplied, it will assume the entity guid from the main agent.
|
|
26
30
|
* @property {string} [parentId] - The parentId for the registered entity. If none was supplied, it will assume the entity guid from the main agent.
|
|
31
|
+
* @property {{assets?: Array<AssetFile>}} [manifest] - An optional manifest describing the MFE's known assets (scripts, stylesheets, images, fonts, etc.) as `AssetFile` entries, used to improve the accuracy of event attribution (errors, logs, ajax, websockets), attribute `BrowserPerformance` resource events (any asset type, not just scripts) and, depending on `timingMethod`, MicroFrontEndTiming values. Each `AssetFile`'s script-capability is inferred from a `.js` suffix on a string `matcher` (a RegExp `matcher` is never inferred as a script), unless overridden via `type: 'script'` or explicitly disabled via `type: 'asset'`. An `AssetFile` with an invalid `matcher` or an unrecognized `type` is discarded/ignored (with a console warning) rather than applied. If omitted, the agent falls back to its existing behavior of only evaluating the script that called `register()` (resource attribution still applies to that script).
|
|
32
|
+
* @property {'entry'|'scripts'|'all'} [timingMethod] - Controls which manifest assets are used to calculate MicroFrontEndTiming values: 'entry' (the default) leaves timing based entirely on the script that called `register()`, unaffected by the manifest; 'scripts' widens the timing window across all script assets; 'all' widens it across every asset.
|
|
27
33
|
*/
|
|
28
34
|
|
|
29
35
|
/**
|
|
@@ -39,18 +45,22 @@
|
|
|
39
45
|
* @property {string} name - The name returned for the registered entity.
|
|
40
46
|
* @property {{[key: string]: any}} [tags] - The tags for the registered entity as key-value pairs.
|
|
41
47
|
* @property {string} [parentId] - The parentId for the registered entity. If none was supplied, it will assume the entity guid from the main agent.
|
|
48
|
+
* @property {import('../../common/v2/manifest').ParsedManifest} [manifest] - The parsed manifest for the registered entity, if one was supplied.
|
|
49
|
+
* @property {'entry'|'scripts'|'all'} [timingMethod] - The timing method supplied for the registered entity, if any.
|
|
42
50
|
*/
|
|
43
51
|
|
|
44
52
|
/**
|
|
45
53
|
* @typedef {Object} RegisterAPITimings
|
|
46
54
|
* @property {number} registeredAt - The timestamp when the registered entity was created.
|
|
47
55
|
* @property {number} [reportedAt] - The timestamp when the registered entity was deregistered.
|
|
48
|
-
* @property {number} fetchStart - The timestamp when the registered entity began fetching (performance.start).
|
|
49
|
-
* @property {number} fetchEnd - The timestamp when the registered entity finished fetching (performance.end).
|
|
50
|
-
* @property {number} scriptStart - The timestamp when script initialization began (max of dom.start or performance.end, or performance.end if no dom.start).
|
|
51
|
-
* @property {number} scriptEnd - The timestamp when script loading completed (dom.end or registeredAt if no dom.end).
|
|
56
|
+
* @property {number} fetchStart - The timestamp when the registered entity began fetching (performance.start). When a manifest with timingMethod 'scripts'|'all' is supplied, this widens to the earliest fetchStart across all matched manifest assets.
|
|
57
|
+
* @property {number} fetchEnd - The timestamp when the registered entity finished fetching (performance.end). When a manifest with timingMethod 'scripts'|'all' is supplied, this widens to the latest fetchEnd across all matched manifest assets.
|
|
58
|
+
* @property {number} scriptStart - The timestamp when script initialization began (max of dom.start or performance.end, or performance.end if no dom.start). When a manifest with timingMethod 'scripts'|'all' is supplied, this widens to the earliest scriptStart across all matched manifest script assets (non-script assets are excluded).
|
|
59
|
+
* @property {number} scriptEnd - The timestamp when script loading completed (dom.end or registeredAt if no dom.end). When a manifest with timingMethod 'scripts'|'all' is supplied, this widens to the latest scriptEnd across all matched manifest script assets (non-script assets are excluded).
|
|
52
60
|
* @property {Object} [asset] - The asset path (if found) for the registered entity.
|
|
53
61
|
* @property {string} type - The type of timing associated with the registered entity, 'script' or 'link' if found with the performance resource API, 'fetch' for dynamic imports, 'inline' if found to be associated with the root document URL, or 'unknown' if no associated resource could be found.
|
|
62
|
+
* @property {number} totalWeight - The sum of `transferSize` (bytes) across every asset detected for the registered entity -- the entry script, plus, when a manifest is supplied, every matched manifest asset (script or non-script). Unlike fetchStart/fetchEnd/scriptStart/scriptEnd above, this is never gated behind `timingMethod` -- manifest assets contribute their bytes even at the 'entry' default/unset. Cross-origin assets without a Timing-Allow-Origin header report 0 bytes per the Resource Timing spec.
|
|
63
|
+
* @property {boolean} [renderBlocking] - True if any detected asset (entry script or matched manifest asset) has a `renderBlockingStatus` of 'blocking'; false if none were 'blocking' but at least one reported 'non-blocking'; left `undefined` if no detected asset reported the attribute at all (e.g. unsupported browser). A single 'blocking' asset always wins over any number of 'non-blocking' ones, regardless of resolution order.
|
|
54
64
|
*/
|
|
55
65
|
|
|
56
66
|
/**
|
|
@@ -17,10 +17,12 @@ import { single } from '../../common/util/invoke';
|
|
|
17
17
|
import { measure } from './measure';
|
|
18
18
|
import { recordCustomEvent } from './recordCustomEvent';
|
|
19
19
|
import { subscribeToPageUnload } from '../../common/window/page-visibility';
|
|
20
|
-
import { findScriptTimings } from '../../common/v2/script-tracker';
|
|
20
|
+
import { findScriptTimings, applyManifestTimings } from '../../common/v2/script-tracker';
|
|
21
21
|
import { trackMFEVitals } from '../../common/v2/mfe-vitals';
|
|
22
22
|
import { generateRandomHexString } from '../../common/ids/unique-id';
|
|
23
|
+
import { parseManifest } from '../../common/v2/manifest';
|
|
23
24
|
import { cleanURL } from '../../common/url/clean-url';
|
|
25
|
+
const TIMING_METHODS = ['entry', 'scripts', 'all'];
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* @typedef {import('./register-api-types').RegisterAPI} RegisterAPI
|
|
@@ -42,7 +44,10 @@ export const warnings = {
|
|
|
42
44
|
experimental: single(() => warn(54, 'newrelic.register')),
|
|
43
45
|
disabled: single(() => warn(55)),
|
|
44
46
|
invalidTarget: single(target => warn(48, target)),
|
|
45
|
-
deregistered: single(() => warn(68))
|
|
47
|
+
deregistered: single(() => warn(68)),
|
|
48
|
+
invalidTimingMethod: single(value => warn(80, value)),
|
|
49
|
+
duplicateName: single(target => warn(81, target)),
|
|
50
|
+
duplicateId: single(target => warn(82, target))
|
|
46
51
|
};
|
|
47
52
|
|
|
48
53
|
/**
|
|
@@ -78,9 +83,17 @@ function register(agentRef, target) {
|
|
|
78
83
|
// getter because this is asynchronously set
|
|
79
84
|
type: V2_TYPES.BA
|
|
80
85
|
};
|
|
86
|
+
target.manifest = parseManifest(target.manifest);
|
|
87
|
+
if (target.timingMethod !== undefined && !TIMING_METHODS.includes(target.timingMethod)) {
|
|
88
|
+
warnings.invalidTimingMethod(target.timingMethod);
|
|
89
|
+
target.timingMethod = undefined;
|
|
90
|
+
}
|
|
81
91
|
|
|
82
92
|
// The script timings for this entity, which will be used to populate part of the MicroFrontEndTiming custom event.
|
|
83
93
|
const timings = findScriptTimings(target);
|
|
94
|
+
// Always applied when a manifest is present -- totalWeight/renderBlocking accumulate from manifest assets
|
|
95
|
+
// regardless of timingMethod; actual timing widening inside stays gated to 'scripts'/'all' (see applyManifestTimings).
|
|
96
|
+
if (target.manifest) applyManifestTimings(timings, target);
|
|
84
97
|
|
|
85
98
|
// Track MFE vitals for this entity, which will be used to populate part of the MicroFrontEndTiming custom event.
|
|
86
99
|
const vitals = trackMFEVitals(target, timings);
|
|
@@ -132,6 +145,19 @@ function register(agentRef, target) {
|
|
|
132
145
|
/** primary cases that can block the register API from working at init time */
|
|
133
146
|
if (!agentRef.init.api.register.enabled) block(warnings.disabled);
|
|
134
147
|
if (!hasValidValue(target.id) || !hasValidValue(target.name)) block(() => warnings.invalidTarget(target));
|
|
148
|
+
/** warn if we see obviously unstable things with MFE targets */
|
|
149
|
+
registeredEntities.forEach(entity => {
|
|
150
|
+
try {
|
|
151
|
+
const {
|
|
152
|
+
name,
|
|
153
|
+
id
|
|
154
|
+
} = entity.metadata.target;
|
|
155
|
+
if (name === target.name && id !== target.id) warnings.duplicateName(target);
|
|
156
|
+
if (id === target.id && name !== target.name) warnings.duplicateId(target);
|
|
157
|
+
} catch (e) {
|
|
158
|
+
// something unexpected went wrong...
|
|
159
|
+
}
|
|
160
|
+
});
|
|
135
161
|
|
|
136
162
|
/** @type {RegisterAPI} */
|
|
137
163
|
const api = {
|
|
@@ -241,6 +267,12 @@ function register(agentRef, target) {
|
|
|
241
267
|
// fetch time and script time together
|
|
242
268
|
timeToRegister: timings.registeredAt,
|
|
243
269
|
// timestamp when register() was called
|
|
270
|
+
totalWeight: timings.totalWeight,
|
|
271
|
+
// sum of transferSize bytes across every detected asset (entry script + matched manifest assets)
|
|
272
|
+
// renderBlocking: true if any detected asset was 'blocking', false if only 'non-blocking' assets were seen, omitted entirely if no detected asset reported the attribute at all
|
|
273
|
+
...(timings.renderBlocking !== undefined && {
|
|
274
|
+
renderBlocking: timings.renderBlocking
|
|
275
|
+
}),
|
|
244
276
|
// leave room to extend these with more data keys as needed
|
|
245
277
|
...(vitals.fcp.value >= 0 && {
|
|
246
278
|
'vitals.fcp.value': vitals.fcp.value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.js","../src/cdn/experimental.js","../src/cdn/lite.js","../src/cdn/pro.js","../src/cdn/spa.js","../src/common/aggregate/aggregator.js","../src/common/aggregate/event-aggregator.js","../src/common/config/configurable.js","../src/common/config/info.js","../src/common/config/init-types.js","../src/common/config/init.js","../src/common/config/loader-config.js","../src/common/config/runtime.js","../src/common/constants/agent-constants.js","../src/common/constants/env.cdn.js","../src/common/constants/env.js","../src/common/constants/env.npm.js","../src/common/constants/events.js","../src/common/constants/iframe-constants.js","../src/common/constants/runtime.js","../src/common/constants/shared-channel.js","../src/common/deny-list/deny-list.js","../src/common/dispatch/global-event.js","../src/common/dom/iframe.js","../src/common/dom/query-selector.js","../src/common/dom/selector-path.js","../src/common/drain/drain.js","../src/common/event-emitter/contextual-ee.js","../src/common/event-emitter/event-context.js","../src/common/event-emitter/handle.js","../src/common/event-emitter/register-handler.js","../src/common/event-listener/event-listener-opts.js","../src/common/harvest/connector.js","../src/common/harvest/harvester.js","../src/common/harvest/send.js","../src/common/harvest/types.js","../src/common/ids/bundle-id.js","../src/common/ids/id.js","../src/common/ids/unique-id.js","../src/common/payloads/payloads.js","../src/common/serialize/bel-serializer.js","../src/common/session/constants.js","../src/common/session/session-entity.js","../src/common/session/session-key.js","../src/common/storage/local-storage.js","../src/common/timer/interaction-timer.js","../src/common/timer/timer.js","../src/common/timing/nav-timing.js","../src/common/timing/now.js","../src/common/timing/time-keeper.js","../src/common/unload/eol.js","../src/common/url/add-url.js","../src/common/url/canonicalize-url.js","../src/common/url/clean-url.js","../src/common/url/encode.js","../src/common/url/extract-url.js","../src/common/url/parse-url.js","../src/common/url/protocol.js","../src/common/util/attribute-size.js","../src/common/util/browser-stack-matchers.js","../src/common/util/console.js","../src/common/util/data-size.js","../src/common/util/event-origin.js","../src/common/util/feature-flags.js","../src/common/util/get-or-set.js","../src/common/util/invoke.js","../src/common/util/monkey-patched.js","../src/common/util/obfuscate.js","../src/common/util/short-circuit.js","../src/common/util/stringify.js","../src/common/util/submit-data.js","../src/common/util/text.js","../src/common/util/traverse.js","../src/common/util/type-check.js","../src/common/util/webdriver-detection.js","../src/common/v2/constants.js","../src/common/v2/mfe-vitals.js","../src/common/v2/script-correlation.js","../src/common/v2/script-tracker-constants.js","../src/common/v2/script-tracker.js","../src/common/v2/timing-factory.js","../src/common/v2/utils.js","../src/common/vitals/constants.js","../src/common/vitals/cumulative-layout-shift.js","../src/common/vitals/first-contentful-paint.js","../src/common/vitals/first-paint.js","../src/common/vitals/interaction-to-next-paint.js","../src/common/vitals/largest-contentful-paint.js","../src/common/vitals/load-time.js","../src/common/vitals/time-to-first-byte.js","../src/common/vitals/vital-metric.js","../src/common/window/load.js","../src/common/window/nreum.js","../src/common/window/page-visibility.js","../src/common/wrap/wrap-events.js","../src/common/wrap/wrap-fetch.js","../src/common/wrap/wrap-function.js","../src/common/wrap/wrap-history.js","../src/common/wrap/wrap-logger.js","../src/common/wrap/wrap-websocket.js","../src/common/wrap/wrap-xhr.js","../src/features/ajax/constants.js","../src/features/ajax/index.js","../src/features/ajax/aggregate/gql.js","../src/features/ajax/aggregate/index.js","../src/features/ajax/instrument/distributed-tracing.js","../src/features/ajax/instrument/index.js","../src/features/ajax/instrument/response-size.js","../src/features/generic_events/constants.js","../src/features/generic_events/index.js","../src/features/generic_events/aggregate/index.js","../src/features/generic_events/aggregate/user-actions/aggregated-user-action.js","../src/features/generic_events/aggregate/user-actions/user-actions-aggregator.js","../src/features/generic_events/instrument/index.js","../src/features/jserrors/constants.js","../src/features/jserrors/index.js","../src/features/jserrors/aggregate/canonical-function-name.js","../src/features/jserrors/aggregate/cause-string.js","../src/features/jserrors/aggregate/compute-stack-trace.js","../src/features/jserrors/aggregate/format-stack-trace.js","../src/features/jserrors/aggregate/index.js","../src/features/jserrors/aggregate/internal-errors.js","../src/features/jserrors/aggregate/string-hash-code.js","../src/features/jserrors/instrument/index.js","../src/features/jserrors/shared/cast-error.js","../src/features/jserrors/shared/uncaught-error.js","../src/features/logging/constants.js","../src/features/logging/index.js","../src/features/logging/aggregate/index.js","../src/features/logging/instrument/index.js","../src/features/logging/shared/log.js","../src/features/logging/shared/utils.js","../src/features/metrics/constants.js","../src/features/metrics/index.js","../src/features/metrics/aggregate/framework-detection.js","../src/features/metrics/aggregate/harvest-metadata.js","../src/features/metrics/aggregate/index.js","../src/features/metrics/instrument/index.js","../src/features/page_action/constants.js","../src/features/page_action/index.js","../src/features/page_action/instrument/index.js","../src/features/page_view_event/constants.js","../src/features/page_view_event/index.js","../src/features/page_view_event/aggregate/index.js","../src/features/page_view_event/aggregate/initialized-features.js","../src/features/page_view_event/aggregate_v2/index.js","../src/features/page_view_event/instrument/index.js","../src/features/page_view_timing/constants.js","../src/features/page_view_timing/index.js","../src/features/page_view_timing/aggregate/index.js","../src/features/page_view_timing/instrument/index.js","../src/features/session_replay/constants.js","../src/features/session_replay/index.js","../src/features/session_replay/aggregate/index.js","../src/features/session_replay/instrument/index.js","../src/features/session_replay/shared/recorder-events.js","../src/features/session_replay/shared/recorder.js","../src/features/session_replay/shared/stylesheet-evaluator.js","../src/features/session_replay/shared/utils.js","../src/features/session_trace/constants.js","../src/features/session_trace/index.js","../src/features/session_trace/aggregate/index.js","../src/features/session_trace/aggregate/trace/node.js","../src/features/session_trace/aggregate/trace/storage.js","../src/features/session_trace/aggregate/trace/utils.js","../src/features/session_trace/instrument/index.js","../src/features/soft_navigations/constants.js","../src/features/soft_navigations/index.js","../src/features/soft_navigations/aggregate/ajax-node.js","../src/features/soft_navigations/aggregate/bel-node.js","../src/features/soft_navigations/aggregate/index.js","../src/features/soft_navigations/aggregate/initial-page-load-interaction.js","../src/features/soft_navigations/aggregate/interaction.js","../src/features/soft_navigations/instrument/index.js","../src/features/utils/agent-session.js","../src/features/utils/aggregate-base.js","../src/features/utils/event-buffer.js","../src/features/utils/feature-base.js","../src/features/utils/feature-gates.js","../src/features/utils/instrument-base.js","../src/interfaces/registered-entity.js","../src/interfaces/registered-iframe-entity.js","../src/loaders/agent-base.js","../src/loaders/agent.js","../src/loaders/api-base.js","../src/loaders/browser-agent.js","../src/loaders/micro-agent-base.js","../src/loaders/micro-agent.js","../src/loaders/api/addPageAction.js","../src/loaders/api/addRelease.js","../src/loaders/api/addToTrace.js","../src/loaders/api/consent.js","../src/loaders/api/constants.js","../src/loaders/api/finished.js","../src/loaders/api/interaction-types.js","../src/loaders/api/interaction.js","../src/loaders/api/log.js","../src/loaders/api/measure.js","../src/loaders/api/noticeError.js","../src/loaders/api/pauseReplay.js","../src/loaders/api/recordCustomEvent.js","../src/loaders/api/recordReplay.js","../src/loaders/api/register-api-types.js","../src/loaders/api/register.js","../src/loaders/api/setApplicationVersion.js","../src/loaders/api/setCustomAttribute.js","../src/loaders/api/setErrorHandler.js","../src/loaders/api/setPageViewName.js","../src/loaders/api/setUserId.js","../src/loaders/api/sharedHandlers.js","../src/loaders/api/start.js","../src/loaders/api/topLevelCallers.js","../src/loaders/api/wrapLogger.js","../src/loaders/configure/configure.js","../src/loaders/configure/iframe-message-handler.js","../src/loaders/configure/nonce.js","../src/loaders/configure/public-path.js","../src/loaders/features/enabled-features.js","../src/loaders/features/featureDependencies.js","../src/loaders/features/features.js"],"version":"5.9.3"}
|
|
1
|
+
{"root":["../src/index.js","../src/cdn/experimental.js","../src/cdn/lite.js","../src/cdn/pro.js","../src/cdn/spa.js","../src/common/aggregate/aggregator.js","../src/common/aggregate/event-aggregator.js","../src/common/config/configurable.js","../src/common/config/info.js","../src/common/config/init-types.js","../src/common/config/init.js","../src/common/config/loader-config.js","../src/common/config/runtime.js","../src/common/constants/agent-constants.js","../src/common/constants/env.cdn.js","../src/common/constants/env.js","../src/common/constants/env.npm.js","../src/common/constants/events.js","../src/common/constants/iframe-constants.js","../src/common/constants/runtime.js","../src/common/constants/shared-channel.js","../src/common/deny-list/deny-list.js","../src/common/dispatch/global-event.js","../src/common/dom/iframe.js","../src/common/dom/query-selector.js","../src/common/dom/selector-path.js","../src/common/drain/drain.js","../src/common/event-emitter/contextual-ee.js","../src/common/event-emitter/event-context.js","../src/common/event-emitter/handle.js","../src/common/event-emitter/register-handler.js","../src/common/event-listener/event-listener-opts.js","../src/common/harvest/connector.js","../src/common/harvest/harvester.js","../src/common/harvest/send.js","../src/common/harvest/types.js","../src/common/ids/bundle-id.js","../src/common/ids/id.js","../src/common/ids/unique-id.js","../src/common/payloads/payloads.js","../src/common/serialize/bel-serializer.js","../src/common/session/constants.js","../src/common/session/session-entity.js","../src/common/session/session-key.js","../src/common/storage/local-storage.js","../src/common/timer/interaction-timer.js","../src/common/timer/timer.js","../src/common/timing/nav-timing.js","../src/common/timing/now.js","../src/common/timing/time-keeper.js","../src/common/unload/eol.js","../src/common/url/add-url.js","../src/common/url/canonicalize-url.js","../src/common/url/clean-url.js","../src/common/url/encode.js","../src/common/url/extract-url.js","../src/common/url/parse-url.js","../src/common/url/protocol.js","../src/common/util/attribute-size.js","../src/common/util/browser-stack-matchers.js","../src/common/util/console.js","../src/common/util/data-size.js","../src/common/util/event-origin.js","../src/common/util/feature-flags.js","../src/common/util/get-or-set.js","../src/common/util/invoke.js","../src/common/util/monkey-patched.js","../src/common/util/obfuscate.js","../src/common/util/short-circuit.js","../src/common/util/stringify.js","../src/common/util/submit-data.js","../src/common/util/text.js","../src/common/util/traverse.js","../src/common/util/type-check.js","../src/common/util/webdriver-detection.js","../src/common/v2/constants.js","../src/common/v2/manifest.js","../src/common/v2/mfe-vitals.js","../src/common/v2/script-correlation.js","../src/common/v2/script-tracker-constants.js","../src/common/v2/script-tracker-types.js","../src/common/v2/script-tracker.js","../src/common/v2/timing-factory.js","../src/common/v2/utils.js","../src/common/vitals/constants.js","../src/common/vitals/cumulative-layout-shift.js","../src/common/vitals/first-contentful-paint.js","../src/common/vitals/first-paint.js","../src/common/vitals/interaction-to-next-paint.js","../src/common/vitals/largest-contentful-paint.js","../src/common/vitals/load-time.js","../src/common/vitals/register-vital.js","../src/common/vitals/time-to-first-byte.js","../src/common/vitals/vital-metric.js","../src/common/window/load.js","../src/common/window/nreum.js","../src/common/window/page-visibility.js","../src/common/wrap/wrap-events.js","../src/common/wrap/wrap-fetch.js","../src/common/wrap/wrap-function.js","../src/common/wrap/wrap-history.js","../src/common/wrap/wrap-logger.js","../src/common/wrap/wrap-websocket.js","../src/common/wrap/wrap-xhr.js","../src/features/ajax/constants.js","../src/features/ajax/index.js","../src/features/ajax/aggregate/gql.js","../src/features/ajax/aggregate/index.js","../src/features/ajax/instrument/distributed-tracing.js","../src/features/ajax/instrument/index.js","../src/features/ajax/instrument/response-size.js","../src/features/generic_events/constants.js","../src/features/generic_events/index.js","../src/features/generic_events/aggregate/index.js","../src/features/generic_events/aggregate/user-actions/aggregated-user-action.js","../src/features/generic_events/aggregate/user-actions/user-actions-aggregator.js","../src/features/generic_events/instrument/index.js","../src/features/jserrors/constants.js","../src/features/jserrors/index.js","../src/features/jserrors/aggregate/canonical-function-name.js","../src/features/jserrors/aggregate/cause-string.js","../src/features/jserrors/aggregate/compute-stack-trace.js","../src/features/jserrors/aggregate/format-stack-trace.js","../src/features/jserrors/aggregate/index.js","../src/features/jserrors/aggregate/internal-errors.js","../src/features/jserrors/aggregate/string-hash-code.js","../src/features/jserrors/instrument/index.js","../src/features/jserrors/shared/cast-error.js","../src/features/jserrors/shared/uncaught-error.js","../src/features/logging/constants.js","../src/features/logging/index.js","../src/features/logging/aggregate/index.js","../src/features/logging/instrument/index.js","../src/features/logging/shared/log.js","../src/features/logging/shared/utils.js","../src/features/metrics/constants.js","../src/features/metrics/index.js","../src/features/metrics/aggregate/framework-detection.js","../src/features/metrics/aggregate/harvest-metadata.js","../src/features/metrics/aggregate/index.js","../src/features/metrics/instrument/index.js","../src/features/page_action/constants.js","../src/features/page_action/index.js","../src/features/page_action/instrument/index.js","../src/features/page_view_event/constants.js","../src/features/page_view_event/index.js","../src/features/page_view_event/aggregate/index.js","../src/features/page_view_event/aggregate/initialized-features.js","../src/features/page_view_event/aggregate_v2/index.js","../src/features/page_view_event/instrument/index.js","../src/features/page_view_timing/constants.js","../src/features/page_view_timing/index.js","../src/features/page_view_timing/aggregate/index.js","../src/features/page_view_timing/instrument/index.js","../src/features/session_replay/constants.js","../src/features/session_replay/index.js","../src/features/session_replay/aggregate/index.js","../src/features/session_replay/instrument/index.js","../src/features/session_replay/shared/recorder-events.js","../src/features/session_replay/shared/recorder.js","../src/features/session_replay/shared/stylesheet-evaluator.js","../src/features/session_replay/shared/utils.js","../src/features/session_trace/constants.js","../src/features/session_trace/index.js","../src/features/session_trace/aggregate/index.js","../src/features/session_trace/aggregate/trace/node.js","../src/features/session_trace/aggregate/trace/storage.js","../src/features/session_trace/aggregate/trace/utils.js","../src/features/session_trace/instrument/index.js","../src/features/soft_navigations/constants.js","../src/features/soft_navigations/index.js","../src/features/soft_navigations/aggregate/ajax-node.js","../src/features/soft_navigations/aggregate/bel-node.js","../src/features/soft_navigations/aggregate/index.js","../src/features/soft_navigations/aggregate/initial-page-load-interaction.js","../src/features/soft_navigations/aggregate/interaction.js","../src/features/soft_navigations/instrument/index.js","../src/features/utils/agent-session.js","../src/features/utils/aggregate-base.js","../src/features/utils/event-buffer.js","../src/features/utils/feature-base.js","../src/features/utils/feature-gates.js","../src/features/utils/instrument-base.js","../src/interfaces/registered-entity.js","../src/interfaces/registered-iframe-entity.js","../src/loaders/agent-base.js","../src/loaders/agent.js","../src/loaders/api-base.js","../src/loaders/browser-agent.js","../src/loaders/micro-agent-base.js","../src/loaders/micro-agent.js","../src/loaders/api/addPageAction.js","../src/loaders/api/addRelease.js","../src/loaders/api/addToTrace.js","../src/loaders/api/consent.js","../src/loaders/api/constants.js","../src/loaders/api/finished.js","../src/loaders/api/interaction-types.js","../src/loaders/api/interaction.js","../src/loaders/api/log.js","../src/loaders/api/measure.js","../src/loaders/api/noticeError.js","../src/loaders/api/pauseReplay.js","../src/loaders/api/recordCustomEvent.js","../src/loaders/api/recordReplay.js","../src/loaders/api/register-api-types.js","../src/loaders/api/register.js","../src/loaders/api/setApplicationVersion.js","../src/loaders/api/setCustomAttribute.js","../src/loaders/api/setErrorHandler.js","../src/loaders/api/setPageViewName.js","../src/loaders/api/setUserId.js","../src/loaders/api/sharedHandlers.js","../src/loaders/api/start.js","../src/loaders/api/topLevelCallers.js","../src/loaders/api/wrapLogger.js","../src/loaders/configure/configure.js","../src/loaders/configure/iframe-message-handler.js","../src/loaders/configure/nonce.js","../src/loaders/configure/public-path.js","../src/loaders/features/enabled-features.js","../src/loaders/features/featureDependencies.js","../src/loaders/features/features.js"],"version":"5.9.3"}
|
|
@@ -21,7 +21,7 @@ export type Init = {
|
|
|
21
21
|
/**
|
|
22
22
|
* - Controls when AJAX request/response payloads are captured. 'none' = never capture, 'failures' = capture only on errors (4xx, 5xx, network errors, GraphQL errors), 'all' = always capture.
|
|
23
23
|
*/
|
|
24
|
-
capture_payloads?: "
|
|
24
|
+
capture_payloads?: "all" | "none" | "failures" | undefined;
|
|
25
25
|
} | undefined;
|
|
26
26
|
api?: {
|
|
27
27
|
register?: {
|
|
@@ -85,6 +85,9 @@
|
|
|
85
85
|
* | 77 | Agent rejected post message, could not validate origin. |
|
|
86
86
|
* | 78 | RegisteredIframeEntity could not determine parent origin and will not register, to avoid trusting messages from any origin. |
|
|
87
87
|
* | 79 | Unable to initialize Connector and/or Harvester. |
|
|
88
|
+
* | 80 | An invalid manifest option was provided to register() and will be ignored. |
|
|
89
|
+
* | 81 | Entities were detected that share a name with different IDs - This can cause multiple entities to have the same name in New Relic. |
|
|
90
|
+
* | 82 | Entities were detected that share an ID with different names - This can cause your entity's name to change unexpectedly. |
|
|
88
91
|
*
|
|
89
92
|
* @param {number} code The warning code to emit, which will be used to link to the warning code documentation
|
|
90
93
|
* @param {*} [secondary] Secondary data to include, usually an extra message, error or object
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../src/common/util/console.js"],"names":[],"mappings":"AAUA
|
|
1
|
+
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../src/common/util/console.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8FG;AAEH,2BALW,MAAM,cACN,GAAC,QAiBX"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} ParsedManifestAsset
|
|
3
|
+
* @property {string|RegExp} pattern - the original matcher supplied by the customer
|
|
4
|
+
* @property {(url: string) => boolean} test - precompiled matcher against a resolved URL
|
|
5
|
+
* @property {boolean} isScript
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} ParsedManifest
|
|
9
|
+
* @property {ParsedManifestAsset[]} assets - all supplied assets
|
|
10
|
+
* @property {ParsedManifestAsset[]} scripts - the subset of assets inferred/declared as scripts (`.js`)
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Parses a raw manifest supplied to `register()` into precompiled matcher closures. Parsing happens once, at
|
|
14
|
+
* registration time, so downstream event attribution (which runs on every ajax/error/log/websocket event) never has
|
|
15
|
+
* to re-derive matching logic from the raw customer input.
|
|
16
|
+
* @param {{assets?: Array<AssetFile>}} [rawManifest]
|
|
17
|
+
* @returns {ParsedManifest|undefined} undefined if no usable assets were supplied, so callers can cheaply skip all manifest logic
|
|
18
|
+
*/
|
|
19
|
+
export function parseManifest(rawManifest?: {
|
|
20
|
+
assets?: Array<AssetFile>;
|
|
21
|
+
}): ParsedManifest | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Determines whether a resolved URL matches any asset in a parsed manifest.
|
|
24
|
+
* @param {ParsedManifest|undefined} parsed
|
|
25
|
+
* @param {string} url
|
|
26
|
+
* @param {{scriptsOnly?: boolean}} [options]
|
|
27
|
+
* @returns {boolean}
|
|
28
|
+
*/
|
|
29
|
+
export function matchManifestAsset(parsed: ParsedManifest | undefined, url: string, { scriptsOnly }?: {
|
|
30
|
+
scriptsOnly?: boolean;
|
|
31
|
+
}): boolean;
|
|
32
|
+
export type ParsedManifestAsset = {
|
|
33
|
+
/**
|
|
34
|
+
* - the original matcher supplied by the customer
|
|
35
|
+
*/
|
|
36
|
+
pattern: string | RegExp;
|
|
37
|
+
/**
|
|
38
|
+
* - precompiled matcher against a resolved URL
|
|
39
|
+
*/
|
|
40
|
+
test: (url: string) => boolean;
|
|
41
|
+
isScript: boolean;
|
|
42
|
+
};
|
|
43
|
+
export type ParsedManifest = {
|
|
44
|
+
/**
|
|
45
|
+
* - all supplied assets
|
|
46
|
+
*/
|
|
47
|
+
assets: ParsedManifestAsset[];
|
|
48
|
+
/**
|
|
49
|
+
* - the subset of assets inferred/declared as scripts (`.js`)
|
|
50
|
+
*/
|
|
51
|
+
scripts: ParsedManifestAsset[];
|
|
52
|
+
};
|
|
53
|
+
export type AssetFile = {
|
|
54
|
+
/**
|
|
55
|
+
* - the path/path-fragment string, or RegExp, used to match a resolved URL against this asset
|
|
56
|
+
*/
|
|
57
|
+
matcher: string | RegExp;
|
|
58
|
+
/**
|
|
59
|
+
* - optional override for script-capability inference. When omitted, script-capability is inferred from a
|
|
60
|
+
* `.js` suffix on a string `matcher` (a RegExp `matcher` is never inferred as a script). Supply `type: 'script'` to explicitly flag an entry
|
|
61
|
+
* as a script regardless of its matcher shape/suffix (e.g. an extensionless URL, or a RegExp targeting a script path), or `type: 'asset'` to
|
|
62
|
+
* explicitly flag it as non-script. Any other value is invalid, logs a warning, and is ignored (falls back to inference).
|
|
63
|
+
*/
|
|
64
|
+
type?: "script" | "asset" | undefined;
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/manifest.js"],"names":[],"mappings":"AAsBA;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AACH,4CAHW;IAAC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;CAAC,GACzB,cAAc,GAAC,SAAS,CASpC;AAiED;;;;;;GAMG;AACH,2CALW,cAAc,GAAC,SAAS,OACxB,MAAM,oBACN;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAC,GACrB,OAAO,CAMnB;;;;;aArGa,MAAM,GAAC,MAAM;;;;UACb,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO;cACxB,OAAO;;;;;;YAKP,mBAAmB,EAAE;;;;aACrB,mBAAmB,EAAE;;;;;;aArBrB,MAAM,GAAC,MAAM"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const _default: {};
|
|
2
|
+
export default _default;
|
|
3
|
+
/**
|
|
4
|
+
* - Widens the live scriptStart/
|
|
5
|
+
* scriptEnd window with one manifest script asset's DOM correlation timing. `start`/`end` are that asset's
|
|
6
|
+
* `correlation.script.start`/`.end`, or falsy if not yet resolved. See `findScriptTimings`, which registers the
|
|
7
|
+
* concrete implementation, for the exact widening semantics (never shrinks either bound).
|
|
8
|
+
*/
|
|
9
|
+
export type RecordManifestScriptWindowFn = (start: number, end: number) => void;
|
|
10
|
+
export type TimingsInternals = {
|
|
11
|
+
/**
|
|
12
|
+
* - Always present (seeded by `getOrCreateInternals`, see
|
|
13
|
+
* `script-tracker.js`). Cleaned URLs already folded into `timings.totalWeight`/`timings.renderBlocking` by
|
|
14
|
+
* `applyResourceWeight`, so the same underlying resource (e.g. a manifest asset that's also the .register calling
|
|
15
|
+
* script itself) is never counted twice.
|
|
16
|
+
*/
|
|
17
|
+
weighedAssetUrls: Set<string>;
|
|
18
|
+
/**
|
|
19
|
+
* - Always present (seeded by
|
|
20
|
+
* `getOrCreateInternals`, see `script-tracker.js`). `findScriptTimings` overrides the seeded default with one that
|
|
21
|
+
* folds into the live `scriptStart`/`scriptEnd` getters instead.
|
|
22
|
+
*/
|
|
23
|
+
recordManifestScriptWindow: RecordManifestScriptWindowFn;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=script-tracker-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script-tracker-types.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/script-tracker-types.js"],"names":[],"mappings":";;;;;;;;2CAMa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI;;;;;;;;sBAQnC,GAAG,CAAC,MAAM,CAAC;;;;;;gCAIX,4BAA4B"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves a script correlation by URL using exact matching. Exported so other features (e.g. generic_events'
|
|
3
|
+
* resource attribution) can key off the same DOM node/load-timing tracking this module already does for every
|
|
4
|
+
* `<script>` element, rather than setting up a second, redundant observer.
|
|
5
|
+
* @param {string} targetUrl - The URL to find
|
|
6
|
+
* @returns {ScriptCorrelation | undefined} - The correlation object if found
|
|
7
|
+
*/
|
|
8
|
+
export function findCorrelation(targetUrl: string): ScriptCorrelation | undefined;
|
|
1
9
|
/**
|
|
2
10
|
* Extracts URLs from stack traces using the same logic as compute-stack-trace.js
|
|
3
11
|
* @param {string} stack The error stack trace
|
|
@@ -10,20 +18,33 @@ export function extractUrlsFromStack(stack: string): string[];
|
|
|
10
18
|
*/
|
|
11
19
|
export function getDeepStackTrace(): Error.stack | undefined;
|
|
12
20
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
21
|
+
* Applies a registered MFE's manifest to a timings object (already populated by `findScriptTimings`). No-op if no
|
|
22
|
+
* manifest is present. Weight/renderBlocking always accumulate from every detected manifest asset; timing widening
|
|
23
|
+
* (fetchStart/fetchEnd/scriptStart/scriptEnd/asset anchor) is opt-in via `timingMethod` -- see `applyManifestEntry`.
|
|
24
|
+
* @param {RegisterAPITimings} timings - the timings object to widen in place
|
|
25
|
+
* @param {RegisterAPITarget} target - the registered MFE target, which may carry a parsed `manifest`
|
|
26
|
+
*/
|
|
27
|
+
export function applyManifestTimings(timings: RegisterAPITimings, target: RegisterAPITarget): void;
|
|
28
|
+
/**
|
|
29
|
+
* Uses the initiator function's stack to find script timing information via the resource timing API.
|
|
30
|
+
* @param {RegisterAPITarget} [target] - the MFE target being registered; its id scopes stale-correlation
|
|
31
|
+
* detection per-MFE rather than per-script-URL (see isCorrelationStale below)
|
|
15
32
|
* @returns {RegisterAPITimings} Object containing script fetch start and end times, and the asset URL if found
|
|
16
33
|
*/
|
|
17
34
|
export function findScriptTimings(target?: RegisterAPITarget): RegisterAPITimings;
|
|
18
35
|
/**
|
|
19
|
-
* @typedef {import('
|
|
36
|
+
* @typedef {import('../../loaders/api/register-api-types').RegisterAPITimings} RegisterAPITimings
|
|
20
37
|
* @typedef {import('../../loaders/api/register-api-types').RegisterAPITarget} RegisterAPITarget
|
|
38
|
+
* @typedef {import('./script-tracker-types').RecordManifestScriptWindowFn} RecordManifestScriptWindowFn
|
|
39
|
+
* @typedef {import('./script-tracker-types').TimingsInternals} TimingsInternals
|
|
21
40
|
*/
|
|
22
41
|
/** export for testing purposes */
|
|
23
42
|
export let thisFile: any;
|
|
24
43
|
/** @type {Map<string, ScriptCorrelation>} - Central registry for script correlations containing both DOM and Performance data */
|
|
25
44
|
export const scriptCorrelations: Map<string, ScriptCorrelation>;
|
|
26
|
-
export type RegisterAPITimings =
|
|
45
|
+
export type RegisterAPITimings = import("../../loaders/api/register-api-types").RegisterAPITimings;
|
|
27
46
|
export type RegisterAPITarget = import("../../loaders/api/register-api-types").RegisterAPITarget;
|
|
47
|
+
export type RecordManifestScriptWindowFn = import("./script-tracker-types").RecordManifestScriptWindowFn;
|
|
48
|
+
export type TimingsInternals = import("./script-tracker-types").TimingsInternals;
|
|
28
49
|
import { ScriptCorrelation } from './script-correlation';
|
|
29
50
|
//# sourceMappingURL=script-tracker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-tracker.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/script-tracker.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"script-tracker.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/script-tracker.js"],"names":[],"mappings":"AAkEA;;;;;;GAMG;AACH,2CAHW,MAAM,GACJ,iBAAiB,GAAG,SAAS,CAIzC;AA6ED;;;;GAIG;AACH,4CAHW,MAAM,GACJ,MAAM,EAAE,CAsBpB;AAED;;;GAGG;AACH,qCAFa,KAAK,CAAC,KAAK,GAAG,SAAS,CAanC;AAwKD;;;;;;GAMG;AACH,8CAHW,kBAAkB,UAClB,iBAAiB,QAmB3B;AAED;;;;;GAKG;AACH,2CAJW,iBAAiB,GAEf,kBAAkB,CAkG9B;AA7dD;;;;;GAKG;AAEH,kCAAkC;AAClC,yBAAmB;AAUnB,iIAAiI;AACjI,iCADW,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CACE;iCAlB9B,OAAO,sCAAsC,EAAE,kBAAkB;gCACjE,OAAO,sCAAsC,EAAE,iBAAiB;2CAChE,OAAO,wBAAwB,EAAE,4BAA4B;+BAC7D,OAAO,wBAAwB,EAAE,gBAAgB;kCAR5B,sBAAsB"}
|
|
@@ -25,6 +25,18 @@ export function getRegisteredEntityByIframeInterfaceId(iframeInterfaceId: string
|
|
|
25
25
|
* @returns {import("../../interfaces/registered-entity").RegisterAPIMetadataTarget[]}
|
|
26
26
|
*/
|
|
27
27
|
export function getRegisteredTargetsFromId(id: string | number, agentRef: any): import("../../interfaces/registered-entity").RegisterAPIMetadataTarget[];
|
|
28
|
+
/**
|
|
29
|
+
* Returns the registered target(s) whose resource matches a given resource URL -- used to attribute `BrowserPerformance`
|
|
30
|
+
* (PerformanceResourceTiming) events, which never have a JS call stack to walk (they're fired for declarative
|
|
31
|
+
* `<script src>`/`<link>`/`<img>` tags, not JS execution), so stack-trace attribution (see {@link findTargetsFromStackTrace})
|
|
32
|
+
* doesn't apply. Unlike {@link getRegisteredTargetsFromFilename}, this matches manifest assets of ANY type (scripts,
|
|
33
|
+
* images, fonts, css, etc.) -- non-script assets can't produce a JS stack frame to match against, but they can and do
|
|
34
|
+
* produce their own resource timing entries. Returns an empty array if no target is found.
|
|
35
|
+
* @param {string} url - the resource's URL, as reported by the Performance API
|
|
36
|
+
* @param {*} agentRef
|
|
37
|
+
* @returns {import("../../interfaces/registered-entity").RegisterAPIMetadataTarget[]}
|
|
38
|
+
*/
|
|
39
|
+
export function getRegisteredTargetsFromResourceUrl(url: string, agentRef: any): import("../../interfaces/registered-entity").RegisterAPIMetadataTarget[];
|
|
28
40
|
/**
|
|
29
41
|
* Returns the registered target(s) associated with a given filename if found in the resource timing API during registration. Returns an empty array if no target is found.
|
|
30
42
|
* Multiple registrations that resolve to the same underlying script asset AND represent the same logical MFE (i.e.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/utils.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/common/v2/utils.js"],"names":[],"mappings":"AAUA;;;;;;GAMG;AAEH;;;;GAIG;AACH,oCAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;GAKG;AACH,0EAJW,MAAM,YACN,GAAC,GACC,OAAO,sCAAsC,EAAE,WAAW,GAAC,SAAS,CAMhF;AAED;;;;;GAKG;AACH,+CAJW,MAAM,GAAC,MAAM,YACb,GAAC,GACC,OAAO,oCAAoC,EAAE,yBAAyB,EAAE,CAMpF;AAED;;;;;;;;;;GAUG;AACH,yDAJW,MAAM,YACN,GAAC,GACC,OAAO,oCAAoC,EAAE,yBAAyB,EAAE,CAmBpF;AAED;;;;;;;;;;;;GAYG;AACH,2DAJW,MAAM,YACN,GAAC,GACC,OAAO,oCAAoC,EAAE,yBAAyB,EAAE,CAgBpF;AAED;;;;;;;;;;;;GAYG;AACH,wEA6BC;AAED;;;;;;;GAOG;AACH,+CAJW,MAAM,sBACN,iBAAiB,GACf,MAAM,CAQlB;AAED;;;;;;;GAOG;AACH,yDAJW,OAAO,oCAAoC,EAAE,yBAAyB,qBACtE,GAAC,GACC,MAAM,CAKlB;AAED;;;;;;GAMG;AACH,wCAJW,OAAO,oCAAoC,EAAE,yBAAyB,qBACtE,GAAC,GACC,OAAO,CAInB;AAED;;;;GAIG;AACH,oDAHW,GAAC,SAqBX;AAED;;;;;;;GAOG;AACH,+DAUC;;;;;UAjOa,IAAI;;;;cACJ,MAAM;;;;;;;;gBAEN;QAAC,CAAC,GAAG,EAAC,MAAM,GAAG,GAAG,CAAA;KAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cumulative-layout-shift.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/cumulative-layout-shift.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cumulative-layout-shift.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/cumulative-layout-shift.js"],"names":[],"mappings":"AAUA,gDAAmG;4BAJvE,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-contentful-paint.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/first-contentful-paint.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"first-contentful-paint.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/first-contentful-paint.js"],"names":[],"mappings":"AAWA,+CAAuF;4BAH3D,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interaction-to-next-paint.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/interaction-to-next-paint.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interaction-to-next-paint.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/interaction-to-next-paint.js"],"names":[],"mappings":"AAUA,iDAA4F;4BALhE,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"largest-contentful-paint.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/largest-contentful-paint.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"largest-contentful-paint.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/largest-contentful-paint.js"],"names":[],"mappings":"AAWA,iDAA2F;4BAN/D,gBAAgB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Invokes a web-vitals registration (e.g. `onLCP(callback)`), tolerating environments where the registration itself
|
|
7
|
+
* throws. web-vitals >= 5 reads Performance Timeline APIs such as `performance.getEntriesByType` unguarded when a
|
|
8
|
+
* metric is registered; where those are missing the metric is simply never reported, instead of the throw failing
|
|
9
|
+
* the feature that imported it.
|
|
10
|
+
* @param {() => void} register
|
|
11
|
+
*/
|
|
12
|
+
export function registerVital(register: () => void): void;
|
|
13
|
+
//# sourceMappingURL=register-vital.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-vital.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/register-vital.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AACH,wCAFW,MAAM,IAAI,QAQpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-to-first-byte.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/time-to-first-byte.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"time-to-first-byte.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/time-to-first-byte.js"],"names":[],"mappings":"AAUA,0CAA8E;4BAJlD,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vital-metric.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/vital-metric.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;IAIE,4CAIC;IAND,eAAY;IAGV,UAAgB;IAChB,UAAe;IACf,oBAAwF;IAG1F;;;
|
|
1
|
+
{"version":3,"file":"vital-metric.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/vital-metric.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;IAIE,4CAIC;IAND,eAAY;IAGV,UAAgB;IAChB,UAAe;IACf,oBAAwF;IAG1F;;;aAiBC;IAED,mBAMC;IAED,uBAEC;IAED,uEAMC;;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/generic_events/aggregate/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/generic_events/aggregate/index.js"],"names":[],"mappings":"AAoBA;IACE,2BAAiC;IAGjC,2BAwRC;IAtRC,gCAAkG;IAIlG,uBAA0C;IAqR5C;;;;;;;;;;;;OAYG;IACH,eAJW,MAAM,YAAC,WACP,MAAM,YAAC,QAkCjB;IAED,6CAEC;IAED;;;MAEC;;CAsBF;8BArX6B,4BAA4B;2BAI/B,gCAAgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/generic_events/instrument/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/generic_events/instrument/index.js"],"names":[],"mappings":"AAyBA;IACE,2BAAiC;IACjC,2BA0HC;IAnGC,+BAA0C;IAC1C,yBAGC;CAgGJ;AAuBD,8CAAuC;+BA9JR,6BAA6B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registered-iframe-entity.d.ts","sourceRoot":"","sources":["../../../src/interfaces/registered-iframe-entity.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registered-iframe-entity.d.ts","sourceRoot":"","sources":["../../../src/interfaces/registered-iframe-entity.js"],"names":[],"mappings":"AAuBA;;;;GAIG;AAEH;;;;;;GAMG;AACH;IAkDE;;;OAGG;IACH,kBAFW,sBAAsB,EAsDhC;IAzGD,kCAAkC;IAClC,UADW,mBAAmB,CAW7B;IAyBD,mBANa,OAAO,EAQnB;IAbD;;;;;;OAMG;IACH,eAFa,OAAO,CAInB;IAoTD;;;;;OAKG;IACH,oBAHW,MAAM,eACN,MAAM,QAIhB;IAED;;;;;;;OAOG;IACH,cAFa,OAAO,CAAC,IAAI,CAAC,CAgBzB;IAED;;;;;SAKK;IACL,6BAHa,MAAM,eACN,MAAM,QAIlB;IAED;;;;;;OAMG;IACH,cAJW,MAAM,YACN;QAAC,KAAK,CAAC,EAAE,MAAM,GAAC,eAAe,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,GAAC,eAAe,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAC,GACvF,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAA;KAAC,CAAC,CAI7F;IAED;;;;;;OAMG;IACH,yBAJW,MAAM,SACN,MAAM,GAAC,MAAM,GAAC,OAAO,GAAC,IAAI,YAC1B,OAAO,QAIjB;IAED;;;;;OAKG;IACH,mBAHW,KAAK,GAAC,MAAM,qBACZ,MAAM,QAIhB;IAED;;;;;OAKG;IACH,iBAHW,MAAM,GAAC,IAAI,iBACX,OAAO,QAIjB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,GAAC,IAAI,QAMrB;IAED;;;;;MAKE;IACF,aAHW,MAAM,YACN;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,GAAC,OAAO,GAAC,OAAO,GAAC,MAAM,GAAC,MAAM,CAAA;KAAC,QAIpF;;CACF;0BA9cY,OAAO,mCAAmC,EAAE,WAAW;kCACvD,OAAO,mCAAmC,EAAE,mBAAmB;qCAC/D,OAAO,mCAAmC,EAAE,sBAAsB"}
|