@ovineko/spa-guard 0.0.2-alpha-1 → 0.0.4
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 +22 -173
- package/dist/ForceRetryError-BWLv3UVK.d.mts +6 -0
- package/dist/_internal.d.ts +149 -20
- package/dist/_internal.js +113 -170
- package/dist/chunk-CfYAbeIz.mjs +13 -0
- package/dist/common/index.d.ts +29 -9
- package/dist/common/index.js +47 -83
- package/dist/errorDispatchers-Cl_pa0DT.mjs +105 -0
- package/dist/i18n/index.d.ts +2 -21
- package/dist/i18n/index.js +344 -341
- package/dist/index-DL8CfPXg.d.mts +26 -0
- package/dist/index-rPxPv6iu.d.mts +16 -0
- package/dist/logger-Cp1Eyk6S.mjs +534 -0
- package/dist/retryOrchestrator-DNGIHV2M.mjs +758 -0
- package/dist/retryOrchestrator-mn9XcIVu.d.mts +257 -0
- package/dist/runtime/debug/index.d.ts +6 -4
- package/dist/runtime/debug/index.js +218 -238
- package/dist/runtime/index.d.ts +66 -8
- package/dist/runtime/index.js +279 -367
- package/dist/schema/index.d.ts +2 -13
- package/dist/schema/index.js +1 -0
- package/dist/schema/parse.d.ts +6 -2
- package/dist/schema/parse.js +29 -44
- package/dist/spinner-BbZVKZ-6.mjs +60 -0
- package/dist/spinner-X23gI09z.d.mts +37 -0
- package/dist/state-I20jENMD.mjs +93 -0
- package/dist/types-DrN8pgyc.d.mts +107 -0
- package/package.json +1 -4
- package/dist/chunk-3UJ67DPX.js +0 -98
- package/dist/chunk-GE63YJOT.js +0 -865
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-PERG4557.js +0 -74
- package/dist/chunk-VZ2DLGXX.js +0 -111
- package/dist/chunk-XIFXSNSD.js +0 -678
- package/dist/common/checkVersion.d.ts +0 -5
- package/dist/common/constants.d.ts +0 -14
- package/dist/common/errors/BeaconError.d.ts +0 -12
- package/dist/common/errors/ForceRetryError.d.ts +0 -5
- package/dist/common/events/index.d.ts +0 -2
- package/dist/common/events/internal.d.ts +0 -13
- package/dist/common/events/types.d.ts +0 -104
- package/dist/common/fallbackRendering.d.ts +0 -23
- package/dist/common/fallbackState.d.ts +0 -3
- package/dist/common/handleErrorWithSpaGuard.d.ts +0 -18
- package/dist/common/html.generated.d.ts +0 -3
- package/dist/common/i18n.d.ts +0 -23
- package/dist/common/isChunkError.d.ts +0 -1
- package/dist/common/isStaticAssetError.d.ts +0 -3
- package/dist/common/lastReloadTime.d.ts +0 -17
- package/dist/common/listen/index.d.ts +0 -1
- package/dist/common/listen/internal.d.ts +0 -2
- package/dist/common/log.d.ts +0 -1
- package/dist/common/logger.d.ts +0 -30
- package/dist/common/options.d.ts +0 -182
- package/dist/common/parseVersion.d.ts +0 -9
- package/dist/common/retryImport.d.ts +0 -43
- package/dist/common/retryOrchestrator.d.ts +0 -35
- package/dist/common/retryState.d.ts +0 -11
- package/dist/common/sendBeacon.d.ts +0 -2
- package/dist/common/serializeError.d.ts +0 -1
- package/dist/common/shouldIgnore.d.ts +0 -13
- package/dist/common/spinner.d.ts +0 -8
- package/dist/common/staticAssetRecovery.d.ts +0 -2
- package/dist/i18n/translations.d.ts +0 -2
- package/dist/runtime/debug/errorDispatchers.d.ts +0 -63
- package/dist/runtime/recommendedSetup.d.ts +0 -36
- package/dist/runtime/state.d.ts +0 -20
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error dispatchers for the debug panel.
|
|
3
|
-
*
|
|
4
|
-
* Unlike the old errorSimulators (which returned promises that callers could catch),
|
|
5
|
-
* these functions return void. Errors are "fire and forget" — they escape to
|
|
6
|
-
* window event listeners (window.error, window.unhandledrejection) where
|
|
7
|
-
* spa-guard's listenInternal() picks them up.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Dispatches an async runtime error via setTimeout.
|
|
11
|
-
* Triggers the window "error" event because the throw happens outside
|
|
12
|
-
* any call stack that could catch it.
|
|
13
|
-
*/
|
|
14
|
-
export declare function dispatchAsyncRuntimeError(): void;
|
|
15
|
-
/**
|
|
16
|
-
* Dispatches an unhandled chunk load error via void Promise.reject().
|
|
17
|
-
* Triggers window "unhandledrejection" with an error matching spa-guard's
|
|
18
|
-
* chunk error detection patterns.
|
|
19
|
-
*/
|
|
20
|
-
export declare function dispatchChunkLoadError(): void;
|
|
21
|
-
/**
|
|
22
|
-
* Dispatches an unhandled chunk error via Promise.finally().
|
|
23
|
-
* The throw inside .finally() with no surrounding catch produces
|
|
24
|
-
* a window "unhandledrejection" event.
|
|
25
|
-
*/
|
|
26
|
-
export declare function dispatchFinallyError(): void;
|
|
27
|
-
/**
|
|
28
|
-
* Dispatches a ForceRetryError via void Promise.reject().
|
|
29
|
-
* Triggers window "unhandledrejection" with a ForceRetryError whose message
|
|
30
|
-
* contains the FORCE_RETRY_MAGIC prefix, exercising the forceRetry path.
|
|
31
|
-
*/
|
|
32
|
-
export declare function dispatchForceRetryError(): void;
|
|
33
|
-
/**
|
|
34
|
-
* Dispatches an unhandled network timeout error after a delay.
|
|
35
|
-
* Uses setTimeout + void Promise.reject() to trigger window "unhandledrejection".
|
|
36
|
-
*/
|
|
37
|
-
export declare function dispatchNetworkTimeout(delayMs?: number): void;
|
|
38
|
-
/**
|
|
39
|
-
* Simulates the retry-exhausted state by emitting the "retry-exhausted" event
|
|
40
|
-
* with finalAttempt equal to the configured reloadDelays length, then renders
|
|
41
|
-
* the fallback UI into the DOM.
|
|
42
|
-
*/
|
|
43
|
-
export declare function dispatchRetryExhausted(): void;
|
|
44
|
-
/**
|
|
45
|
-
* Simulates a static asset 404 by appending a <script> element with a
|
|
46
|
-
* nonexistent hashed URL to document.head. The browser fires an "error"
|
|
47
|
-
* event on the element, which spa-guard's listenInternal() detects via
|
|
48
|
-
* the Resource Timing API-based isLikely404 check.
|
|
49
|
-
*/
|
|
50
|
-
export declare function dispatchStaticAsset404(): void;
|
|
51
|
-
/**
|
|
52
|
-
* Dispatches a sync runtime error via CustomEvent.
|
|
53
|
-
* DebugSyncErrorTrigger (a React component) listens for this event,
|
|
54
|
-
* stores the error in state, and throws it during render so that
|
|
55
|
-
* React Error Boundary can catch it.
|
|
56
|
-
*/
|
|
57
|
-
export declare function dispatchSyncRuntimeError(): void;
|
|
58
|
-
/**
|
|
59
|
-
* Dispatches a plain unhandled promise rejection via void Promise.reject().
|
|
60
|
-
* This is NOT a chunk error and NOT a ForceRetry — it exercises the
|
|
61
|
-
* handleUnhandledRejections config path for generic rejections.
|
|
62
|
-
*/
|
|
63
|
-
export declare function dispatchUnhandledRejection(): void;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export interface RecommendedSetupOptions {
|
|
2
|
-
/**
|
|
3
|
-
* Healthy boot handling strategy.
|
|
4
|
-
*
|
|
5
|
-
* - `"auto"` (default): if retry URL params are present, mark healthy boot
|
|
6
|
-
* after a grace period and only when orchestrator is still idle.
|
|
7
|
-
* - `"manual"`: never auto-mark; call `markRetryHealthyBoot()` yourself.
|
|
8
|
-
* - `"off"` / `false`: disable healthy boot handling.
|
|
9
|
-
*/
|
|
10
|
-
healthyBoot?: RecommendedSetupHealthyBoot;
|
|
11
|
-
/**
|
|
12
|
-
* Whether to start version checking.
|
|
13
|
-
* @default true
|
|
14
|
-
*/
|
|
15
|
-
versionCheck?: boolean;
|
|
16
|
-
}
|
|
17
|
-
interface HealthyBootAutoConfig {
|
|
18
|
-
/**
|
|
19
|
-
* Delay before auto-marking healthy boot when retry params are present in URL.
|
|
20
|
-
* @default dynamic:
|
|
21
|
-
* max(5000, max(reloadDelays)+1000, sum(lazyRetry.retryDelays)+1000)
|
|
22
|
-
*/
|
|
23
|
-
graceMs?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Explicit mode for object config.
|
|
26
|
-
* @default "auto"
|
|
27
|
-
*/
|
|
28
|
-
mode?: "auto";
|
|
29
|
-
}
|
|
30
|
-
type RecommendedSetupHealthyBoot = "auto" | "manual" | "off" | false | HealthyBootAutoConfig;
|
|
31
|
-
/**
|
|
32
|
-
* Enable recommended runtime features with sensible defaults.
|
|
33
|
-
* Returns a cleanup function that tears down all started features.
|
|
34
|
-
*/
|
|
35
|
-
export declare const recommendedSetup: (overrides?: RecommendedSetupOptions) => (() => void);
|
|
36
|
-
export {};
|
package/dist/runtime/state.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { UnsubscribeFn } from "../common/events/types";
|
|
2
|
-
export interface SpaGuardState {
|
|
3
|
-
currentAttempt: number;
|
|
4
|
-
isFallbackShown: boolean;
|
|
5
|
-
isWaiting: boolean;
|
|
6
|
-
/**
|
|
7
|
-
* ID of the previous retry cycle before reset.
|
|
8
|
-
* Undefined if no reset has occurred yet.
|
|
9
|
-
*/
|
|
10
|
-
lastResetRetryId?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Timestamp of the last retry cycle reset.
|
|
13
|
-
* Undefined if no reset has occurred yet.
|
|
14
|
-
*/
|
|
15
|
-
lastRetryResetTime?: number;
|
|
16
|
-
}
|
|
17
|
-
type StateSubscriber = (state: SpaGuardState) => void;
|
|
18
|
-
export declare const getState: () => SpaGuardState;
|
|
19
|
-
export declare const subscribeToState: (cb: StateSubscriber) => UnsubscribeFn;
|
|
20
|
-
export {};
|