@absolutejs/beacon 0.6.40 → 0.6.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +66 -8
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -175,10 +175,11 @@ beacon.captureMessage("checkout started", "info");
|
|
|
175
175
|
online state, transport, and page visibility preserved in
|
|
176
176
|
`extra.networkFailures`.
|
|
177
177
|
- **Runtime boundary signals** — abnormal WebSocket closes, WebSocket and SSE
|
|
178
|
-
reconnect flapping,
|
|
178
|
+
reconnect flapping, terminal service-worker registration/install failures, and
|
|
179
179
|
dedicated/shared worker construction, runtime, and message-decoding failures
|
|
180
180
|
become replay-linked warnings. Normal socket closes, page teardown, hidden-tab
|
|
181
|
-
SSE errors,
|
|
181
|
+
SSE errors, transient registrations recovered during the configured grace
|
|
182
|
+
period, and successfully replaced service workers are exempt.
|
|
182
183
|
- **Attributed reliability signals** — Event Timing identifies genuinely slow
|
|
183
184
|
interactions and separates input delay, handler time, and presentation delay.
|
|
184
185
|
Overlapping long animation frames include their worst script when the browser
|
package/dist/index.d.ts
CHANGED
|
@@ -351,6 +351,10 @@ export type BeaconSignals = {
|
|
|
351
351
|
scrollJail?: boolean;
|
|
352
352
|
/** Service-worker registration and installation failures. Default true. */
|
|
353
353
|
serviceWorkerFailures?: boolean;
|
|
354
|
+
/** Grace period for a transient service-worker registration failure to
|
|
355
|
+
* recover through an application retry before it becomes an issue. Persistent
|
|
356
|
+
* browser rejections still report immediately. Default 8000ms. */
|
|
357
|
+
serviceWorkerRecoveryMs?: number;
|
|
354
358
|
/** Abnormal WebSocket closes (`wasClean: false` or non-normal codes).
|
|
355
359
|
* Default true. */
|
|
356
360
|
socketAbnormalCloses?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -469,6 +469,7 @@ var LONG_IDENTIFIER_SEGMENT = /\b(?:[0-9a-f]{16,}|\d{8,})\b/giu;
|
|
|
469
469
|
var VOLATILE_SIGNAL_TAGS = new Set([
|
|
470
470
|
"actionId",
|
|
471
471
|
"blockingDurationMs",
|
|
472
|
+
"blockingFrameDurationMs",
|
|
472
473
|
"blockerLocations",
|
|
473
474
|
"blockerScope",
|
|
474
475
|
"closeCount",
|
|
@@ -476,10 +477,13 @@ var VOLATILE_SIGNAL_TAGS = new Set([
|
|
|
476
477
|
"durationMs",
|
|
477
478
|
"elapsedMs",
|
|
478
479
|
"errorCount",
|
|
480
|
+
"inputDelayMs",
|
|
479
481
|
"interactionId",
|
|
480
482
|
"loadCount",
|
|
481
483
|
"newestRelease",
|
|
482
484
|
"obscuredPx",
|
|
485
|
+
"presentationDelayMs",
|
|
486
|
+
"processingDurationMs",
|
|
483
487
|
"responseMs",
|
|
484
488
|
"shiftValue",
|
|
485
489
|
"signal",
|
|
@@ -758,6 +762,7 @@ var createBeacon = (options) => {
|
|
|
758
762
|
const SSE_FLAP_DEFAULT_COUNT = 4;
|
|
759
763
|
const SSE_FLAP_DEFAULT_WINDOW_MS = 60000;
|
|
760
764
|
const STALLED_STREAM_DEFAULT_MS = 60000;
|
|
765
|
+
const SERVICE_WORKER_RECOVERY_DEFAULT_MS = 8000;
|
|
761
766
|
const MODAL_FOCUS_SETTLE_MS = 100;
|
|
762
767
|
const MAIN_THREAD_STALL_DEFAULT_MS = 200;
|
|
763
768
|
const MAIN_THREAD_STALL_DEFAULT_COUNT = 3;
|
|
@@ -2073,6 +2078,9 @@ var createBeacon = (options) => {
|
|
|
2073
2078
|
const overlapY = Math.min(first.rect.bottom, second.rect.bottom) - Math.max(first.rect.top, second.rect.top);
|
|
2074
2079
|
const isOverlap = overlapX > CONTROL_COLLISION_OVERLAP_TOLERANCE_PX && overlapY > CONTROL_COLLISION_OVERLAP_TOLERANCE_PX;
|
|
2075
2080
|
if (isOverlap) {
|
|
2081
|
+
if (first.element.parentElement === second.element.parentElement && (first.positioned || second.positioned)) {
|
|
2082
|
+
continue;
|
|
2083
|
+
}
|
|
2076
2084
|
const axis2 = overlapY <= overlapX ? "vertical" : "horizontal";
|
|
2077
2085
|
reportScanIssue(first.element, BEACON_SIGNAL.CONTROL_COLLISION, `Control collision — ${describeElement(first.element)} overlaps ${describeElement(second.element)}`, {
|
|
2078
2086
|
collidesWith: describeElement(second.element),
|
|
@@ -2372,6 +2380,7 @@ var createBeacon = (options) => {
|
|
|
2372
2380
|
const loadingFirstSeen = new WeakMap;
|
|
2373
2381
|
const reportedStuckLoading = new WeakSet;
|
|
2374
2382
|
const trackedLoadingIndicators = new Set;
|
|
2383
|
+
let lastLoadingCheckAt;
|
|
2375
2384
|
const loadingIndicatorSelector = `[aria-busy="true"], [role="progressbar"], [${BEACON_ATTRIBUTE.LOADING}]`;
|
|
2376
2385
|
const resetLoadingIndicator = (indicator) => {
|
|
2377
2386
|
loadingFirstSeen.delete(indicator);
|
|
@@ -2417,13 +2426,15 @@ var createBeacon = (options) => {
|
|
|
2417
2426
|
const checkStuckLoading = () => {
|
|
2418
2427
|
if (document.visibilityState === "hidden")
|
|
2419
2428
|
return;
|
|
2429
|
+
const now = Date.now();
|
|
2430
|
+
const missedPollWindow = lastLoadingCheckAt !== undefined && now - lastLoadingCheckAt > STUCK_LOADING_POLL_MS * 3;
|
|
2431
|
+
lastLoadingCheckAt = now;
|
|
2420
2432
|
const indicators = Array.from(document.querySelectorAll(loadingIndicatorSelector));
|
|
2421
2433
|
const activeIndicators = new Set(indicators);
|
|
2422
2434
|
for (const tracked of trackedLoadingIndicators) {
|
|
2423
2435
|
if (!activeIndicators.has(tracked))
|
|
2424
2436
|
resetLoadingIndicator(tracked);
|
|
2425
2437
|
}
|
|
2426
|
-
const now = Date.now();
|
|
2427
2438
|
for (const indicator of indicators) {
|
|
2428
2439
|
if (isPersistentDeterminateProgress(indicator) || isScanExempt(indicator) || hasHiddenAncestor(indicator) || hasTrackedLoadingAncestor(indicator)) {
|
|
2429
2440
|
resetLoadingIndicator(indicator);
|
|
@@ -2434,6 +2445,9 @@ var createBeacon = (options) => {
|
|
|
2434
2445
|
resetLoadingIndicator(indicator);
|
|
2435
2446
|
continue;
|
|
2436
2447
|
}
|
|
2448
|
+
if (missedPollWindow && loadingFirstSeen.has(indicator)) {
|
|
2449
|
+
loadingFirstSeen.set(indicator, now);
|
|
2450
|
+
}
|
|
2437
2451
|
const firstSeen = loadingFirstSeen.get(indicator);
|
|
2438
2452
|
if (firstSeen === undefined) {
|
|
2439
2453
|
loadingFirstSeen.set(indicator, now);
|
|
@@ -2470,16 +2484,26 @@ var createBeacon = (options) => {
|
|
|
2470
2484
|
reportScanIssue(root, BEACON_SIGNAL.BLANK_APP_ROOT, `Blank application root — ${name} rendered no meaningful content`, {});
|
|
2471
2485
|
}
|
|
2472
2486
|
};
|
|
2487
|
+
const documentStylesAreReady = () => {
|
|
2488
|
+
const stylesheets = Array.from(document.querySelectorAll('link[rel~="stylesheet"]')).filter((link) => {
|
|
2489
|
+
if (link.disabled)
|
|
2490
|
+
return false;
|
|
2491
|
+
const media = link.media.trim();
|
|
2492
|
+
return media === "" || typeof window.matchMedia !== "function" || window.matchMedia(media).matches;
|
|
2493
|
+
});
|
|
2494
|
+
return stylesheets.every((link) => link.sheet !== null);
|
|
2495
|
+
};
|
|
2473
2496
|
const runSettledScan = () => {
|
|
2474
|
-
|
|
2497
|
+
const visualStylesReady = documentStylesAreReady();
|
|
2498
|
+
if (detectOverflow && visualStylesReady)
|
|
2475
2499
|
scanForOverflow();
|
|
2476
|
-
if (detectControlCollision)
|
|
2500
|
+
if (detectControlCollision && visualStylesReady)
|
|
2477
2501
|
scanForControlCollisions();
|
|
2478
|
-
if (detectOcclusion)
|
|
2502
|
+
if (detectOcclusion && visualStylesReady)
|
|
2479
2503
|
scanForOcclusion();
|
|
2480
|
-
if (detectInvisibleText)
|
|
2504
|
+
if (detectInvisibleText && visualStylesReady)
|
|
2481
2505
|
scanForInvisibleText();
|
|
2482
|
-
if (detectThemeMismatch)
|
|
2506
|
+
if (detectThemeMismatch && visualStylesReady)
|
|
2483
2507
|
scanForThemeMismatch();
|
|
2484
2508
|
if (detectStuckLoading)
|
|
2485
2509
|
checkStuckLoading();
|
|
@@ -3699,6 +3723,13 @@ var createBeacon = (options) => {
|
|
|
3699
3723
|
const container = navigator.serviceWorker;
|
|
3700
3724
|
const reportedServiceWorkerFailures = new Set;
|
|
3701
3725
|
const serviceWorkerListenerCleanups = [];
|
|
3726
|
+
const pendingRegistrationFailures = new Map;
|
|
3727
|
+
const transientRegistrationErrors = new Set([
|
|
3728
|
+
"AbortError",
|
|
3729
|
+
"NetworkError",
|
|
3730
|
+
"TimeoutError",
|
|
3731
|
+
"TypeError"
|
|
3732
|
+
]);
|
|
3702
3733
|
const reportServiceWorkerFailure = (endpointLabel, failureKind2, error) => {
|
|
3703
3734
|
const key = `${endpointLabel}|${failureKind2}`;
|
|
3704
3735
|
if (reportedServiceWorkerFailures.has(key))
|
|
@@ -3749,9 +3780,32 @@ var createBeacon = (options) => {
|
|
|
3749
3780
|
if (isServiceWorkerRegistration(registration)) {
|
|
3750
3781
|
watchRegistration(registration);
|
|
3751
3782
|
}
|
|
3783
|
+
const pendingFailure = pendingRegistrationFailures.get(endpointLabel);
|
|
3784
|
+
if (pendingFailure !== undefined) {
|
|
3785
|
+
clearTimeout(pendingFailure.timeout);
|
|
3786
|
+
pendingRegistrationFailures.delete(endpointLabel);
|
|
3787
|
+
}
|
|
3752
3788
|
return registration;
|
|
3753
3789
|
} catch (error) {
|
|
3754
|
-
|
|
3790
|
+
const registrationError = toError(error);
|
|
3791
|
+
if (transientRegistrationErrors.has(registrationError.name)) {
|
|
3792
|
+
const existing = pendingRegistrationFailures.get(endpointLabel);
|
|
3793
|
+
if (existing !== undefined) {
|
|
3794
|
+
existing.error = registrationError;
|
|
3795
|
+
} else {
|
|
3796
|
+
const recoveryMs = Math.max(0, signals.serviceWorkerRecoveryMs ?? SERVICE_WORKER_RECOVERY_DEFAULT_MS);
|
|
3797
|
+
const pending = {
|
|
3798
|
+
error: registrationError,
|
|
3799
|
+
timeout: setTimeout(() => {
|
|
3800
|
+
pendingRegistrationFailures.delete(endpointLabel);
|
|
3801
|
+
reportServiceWorkerFailure(endpointLabel, "registration", pending.error);
|
|
3802
|
+
}, recoveryMs)
|
|
3803
|
+
};
|
|
3804
|
+
pendingRegistrationFailures.set(endpointLabel, pending);
|
|
3805
|
+
}
|
|
3806
|
+
} else {
|
|
3807
|
+
reportServiceWorkerFailure(endpointLabel, "registration", registrationError);
|
|
3808
|
+
}
|
|
3755
3809
|
throw error;
|
|
3756
3810
|
}
|
|
3757
3811
|
};
|
|
@@ -3760,6 +3814,10 @@ var createBeacon = (options) => {
|
|
|
3760
3814
|
container.addEventListener("messageerror", onMessageError);
|
|
3761
3815
|
cleanups.push(() => {
|
|
3762
3816
|
container.removeEventListener("messageerror", onMessageError);
|
|
3817
|
+
for (const pending of pendingRegistrationFailures.values()) {
|
|
3818
|
+
clearTimeout(pending.timeout);
|
|
3819
|
+
}
|
|
3820
|
+
pendingRegistrationFailures.clear();
|
|
3763
3821
|
for (const cleanup of serviceWorkerListenerCleanups.splice(0, serviceWorkerListenerCleanups.length)) {
|
|
3764
3822
|
cleanup();
|
|
3765
3823
|
}
|
|
@@ -4203,5 +4261,5 @@ export {
|
|
|
4203
4261
|
BEACON_ATTRIBUTE
|
|
4204
4262
|
};
|
|
4205
4263
|
|
|
4206
|
-
//# debugId=
|
|
4264
|
+
//# debugId=B81C5AAC4403BF5B64756E2164756E21
|
|
4207
4265
|
//# sourceMappingURL=index.js.map
|