@module-federation/retry-plugin 0.0.0-perf-devtools-20260107043700 → 0.0.0-perf-website-code-usage-20260914033703
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 +50 -61
- package/dist/CHANGELOG.md +177 -3
- package/dist/README.md +50 -61
- package/dist/esm/index.js +288 -341
- package/dist/index.d.ts +25 -22
- package/dist/index.js +294 -371
- package/package.json +13 -3
- package/dist/index.d.mts +0 -110
- package/dist/package.json +0 -41
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ModuleFederationRuntimePlugin } from
|
|
1
|
+
import { ModuleFederationRuntimePlugin } from "@module-federation/runtime";
|
|
2
2
|
|
|
3
|
+
//#region src/types.d.ts
|
|
3
4
|
type CommonRetryOptions = {
|
|
4
5
|
/**
|
|
5
6
|
* retry request options
|
|
@@ -14,9 +15,10 @@ type CommonRetryOptions = {
|
|
|
14
15
|
*/
|
|
15
16
|
successTimes?: number;
|
|
16
17
|
/**
|
|
17
|
-
* retry delay
|
|
18
|
+
* retry delay in milliseconds, or a function that returns delay per attempt.
|
|
19
|
+
* When a function, `attempt` is 1-indexed (the nth retry, not the initial call).
|
|
18
20
|
*/
|
|
19
|
-
retryDelay?: number;
|
|
21
|
+
retryDelay?: number | ((attempt: number) => number);
|
|
20
22
|
/**
|
|
21
23
|
* retry path
|
|
22
24
|
*/
|
|
@@ -24,9 +26,10 @@ type CommonRetryOptions = {
|
|
|
24
26
|
/**
|
|
25
27
|
* add query parameter
|
|
26
28
|
*/
|
|
27
|
-
addQuery?:
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
addQuery?: boolean | ((context: {
|
|
30
|
+
times: number;
|
|
31
|
+
originalQuery: string;
|
|
32
|
+
}) => string);
|
|
30
33
|
/**
|
|
31
34
|
* retry domains
|
|
32
35
|
*/
|
|
@@ -41,7 +44,7 @@ type CommonRetryOptions = {
|
|
|
41
44
|
onRetry?: ({
|
|
42
45
|
times,
|
|
43
46
|
domains,
|
|
44
|
-
url
|
|
47
|
+
url
|
|
45
48
|
}: {
|
|
46
49
|
times?: number;
|
|
47
50
|
domains?: string[];
|
|
@@ -54,7 +57,7 @@ type CommonRetryOptions = {
|
|
|
54
57
|
onSuccess?: ({
|
|
55
58
|
domains,
|
|
56
59
|
url,
|
|
57
|
-
tagName
|
|
60
|
+
tagName
|
|
58
61
|
}: {
|
|
59
62
|
domains?: string[];
|
|
60
63
|
url?: string;
|
|
@@ -66,35 +69,34 @@ type CommonRetryOptions = {
|
|
|
66
69
|
onError?: ({
|
|
67
70
|
domains,
|
|
68
71
|
url,
|
|
69
|
-
tagName
|
|
72
|
+
tagName
|
|
70
73
|
}: {
|
|
71
74
|
domains?: string[];
|
|
72
75
|
url?: string;
|
|
73
76
|
tagName?: string;
|
|
74
77
|
}) => void;
|
|
75
78
|
};
|
|
76
|
-
|
|
77
79
|
type FetchRetryOptions = {
|
|
78
80
|
url?: string;
|
|
79
81
|
fetchOptions?: RequestInit;
|
|
80
82
|
} & CommonRetryOptions;
|
|
81
|
-
|
|
82
83
|
type ScriptRetryOptions = {
|
|
83
84
|
retryOptions: CommonRetryOptions;
|
|
84
85
|
retryFn: (...args: any[]) => Promise<any> | (() => Promise<any>);
|
|
85
86
|
beforeExecuteRetry?: (...args: any[]) => void;
|
|
86
87
|
};
|
|
87
|
-
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/utils.d.ts
|
|
88
90
|
declare function rewriteWithNextDomain(currentUrl: string, domains?: string[]): string | null;
|
|
89
91
|
declare function appendRetryCountQuery(url: string, retryIndex: number, key?: string): string;
|
|
90
92
|
declare function getRetryUrl(baseUrl: string, opts?: {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
domains?: string[];
|
|
94
|
+
addQuery?: boolean | ((context: {
|
|
95
|
+
times: number;
|
|
96
|
+
originalQuery: string;
|
|
97
|
+
}) => string);
|
|
98
|
+
retryIndex?: number;
|
|
99
|
+
queryKey?: string;
|
|
98
100
|
}): string;
|
|
99
101
|
/**
|
|
100
102
|
* Extract domain/host info from a URL and combine it with path/query from another URL
|
|
@@ -104,7 +106,8 @@ declare function getRetryUrl(baseUrl: string, opts?: {
|
|
|
104
106
|
* @returns Combined URL with domain from domainUrl and path/query from pathQueryUrl
|
|
105
107
|
*/
|
|
106
108
|
declare function combineUrlDomainWithPathQuery(domainUrl: string, pathQueryUrl: string): string;
|
|
107
|
-
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/index.d.ts
|
|
108
111
|
declare const RetryPlugin: (params?: CommonRetryOptions) => ModuleFederationRuntimePlugin;
|
|
109
|
-
|
|
110
|
-
export { type CommonRetryOptions, type FetchRetryOptions, RetryPlugin, type ScriptRetryOptions, appendRetryCountQuery, combineUrlDomainWithPathQuery, getRetryUrl, rewriteWithNextDomain };
|
|
112
|
+
//#endregion
|
|
113
|
+
export { type CommonRetryOptions, type FetchRetryOptions, RetryPlugin, type ScriptRetryOptions, appendRetryCountQuery, combineUrlDomainWithPathQuery, getRetryUrl, rewriteWithNextDomain };
|