@module-federation/retry-plugin 2.0.0 → 2.1.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.
- package/dist/CHANGELOG.md +14 -0
- package/dist/esm/index.js +282 -341
- package/dist/index.d.ts +641 -20
- package/dist/index.js +288 -371
- package/dist/package.json +1 -1
- package/package.json +3 -3
- package/dist/index.d.mts +0 -110
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/retry-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"author": "danpeen <dapeen.feng@gmail.com>",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@module-federation/runtime": "2.
|
|
36
|
+
"@module-federation/runtime": "2.1.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@module-federation/sdk": "2.
|
|
39
|
+
"@module-federation/sdk": "2.1.0"
|
|
40
40
|
}
|
|
41
41
|
}
|
package/dist/index.d.mts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { ModuleFederationRuntimePlugin } from '@module-federation/runtime/types';
|
|
2
|
-
|
|
3
|
-
type CommonRetryOptions = {
|
|
4
|
-
/**
|
|
5
|
-
* retry request options
|
|
6
|
-
*/
|
|
7
|
-
fetchOptions?: RequestInit;
|
|
8
|
-
/**
|
|
9
|
-
* retry times
|
|
10
|
-
*/
|
|
11
|
-
retryTimes?: number;
|
|
12
|
-
/**
|
|
13
|
-
* retry success times
|
|
14
|
-
*/
|
|
15
|
-
successTimes?: number;
|
|
16
|
-
/**
|
|
17
|
-
* retry delay
|
|
18
|
-
*/
|
|
19
|
-
retryDelay?: number;
|
|
20
|
-
/**
|
|
21
|
-
* retry path
|
|
22
|
-
*/
|
|
23
|
-
getRetryPath?: (url: string) => string;
|
|
24
|
-
/**
|
|
25
|
-
* add query parameter
|
|
26
|
-
*/
|
|
27
|
-
addQuery?:
|
|
28
|
-
| boolean
|
|
29
|
-
| ((context: { times: number; originalQuery: string }) => string);
|
|
30
|
-
/**
|
|
31
|
-
* retry domains
|
|
32
|
-
*/
|
|
33
|
-
domains?: string[];
|
|
34
|
-
/**
|
|
35
|
-
* retry manifest domains
|
|
36
|
-
*/
|
|
37
|
-
manifestDomains?: string[];
|
|
38
|
-
/**
|
|
39
|
-
* retry callback
|
|
40
|
-
*/
|
|
41
|
-
onRetry?: ({
|
|
42
|
-
times,
|
|
43
|
-
domains,
|
|
44
|
-
url,
|
|
45
|
-
}: {
|
|
46
|
-
times?: number;
|
|
47
|
-
domains?: string[];
|
|
48
|
-
url?: string;
|
|
49
|
-
tagName?: string;
|
|
50
|
-
}) => void;
|
|
51
|
-
/**
|
|
52
|
-
* retry success callback
|
|
53
|
-
*/
|
|
54
|
-
onSuccess?: ({
|
|
55
|
-
domains,
|
|
56
|
-
url,
|
|
57
|
-
tagName,
|
|
58
|
-
}: {
|
|
59
|
-
domains?: string[];
|
|
60
|
-
url?: string;
|
|
61
|
-
tagName?: string;
|
|
62
|
-
}) => void;
|
|
63
|
-
/**
|
|
64
|
-
* retry failure callback
|
|
65
|
-
*/
|
|
66
|
-
onError?: ({
|
|
67
|
-
domains,
|
|
68
|
-
url,
|
|
69
|
-
tagName,
|
|
70
|
-
}: {
|
|
71
|
-
domains?: string[];
|
|
72
|
-
url?: string;
|
|
73
|
-
tagName?: string;
|
|
74
|
-
}) => void;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
type FetchRetryOptions = {
|
|
78
|
-
url?: string;
|
|
79
|
-
fetchOptions?: RequestInit;
|
|
80
|
-
} & CommonRetryOptions;
|
|
81
|
-
|
|
82
|
-
type ScriptRetryOptions = {
|
|
83
|
-
retryOptions: CommonRetryOptions;
|
|
84
|
-
retryFn: (...args: any[]) => Promise<any> | (() => Promise<any>);
|
|
85
|
-
beforeExecuteRetry?: (...args: any[]) => void;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
declare function rewriteWithNextDomain(currentUrl: string, domains?: string[]): string | null;
|
|
89
|
-
declare function appendRetryCountQuery(url: string, retryIndex: number, key?: string): string;
|
|
90
|
-
declare function getRetryUrl(baseUrl: string, opts?: {
|
|
91
|
-
domains?: string[];
|
|
92
|
-
addQuery?: boolean | ((context: {
|
|
93
|
-
times: number;
|
|
94
|
-
originalQuery: string;
|
|
95
|
-
}) => string);
|
|
96
|
-
retryIndex?: number;
|
|
97
|
-
queryKey?: string;
|
|
98
|
-
}): string;
|
|
99
|
-
/**
|
|
100
|
-
* Extract domain/host info from a URL and combine it with path/query from another URL
|
|
101
|
-
* This is useful for domain rotation while preserving original path and query parameters
|
|
102
|
-
* @param domainUrl - URL containing the target domain/host
|
|
103
|
-
* @param pathQueryUrl - URL containing the target path and query parameters
|
|
104
|
-
* @returns Combined URL with domain from domainUrl and path/query from pathQueryUrl
|
|
105
|
-
*/
|
|
106
|
-
declare function combineUrlDomainWithPathQuery(domainUrl: string, pathQueryUrl: string): string;
|
|
107
|
-
|
|
108
|
-
declare const RetryPlugin: (params?: CommonRetryOptions) => ModuleFederationRuntimePlugin;
|
|
109
|
-
|
|
110
|
-
export { type CommonRetryOptions, type FetchRetryOptions, RetryPlugin, type ScriptRetryOptions, appendRetryCountQuery, combineUrlDomainWithPathQuery, getRetryUrl, rewriteWithNextDomain };
|