@ray-js/api 1.7.54 → 1.7.55
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/lib/getCdnUrl/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ interface IImageProcessOptions {
|
|
|
25
25
|
* @param path - 图片路径
|
|
26
26
|
* @param cdnMap - CDN 地址映射表,若未提供,则使用内置 regionMap 直接与 path 进行拼接
|
|
27
27
|
* @param region - 区域代码,若未提供,则使用内置方法获取,EU 兜底
|
|
28
|
+
* @param process - 图片处理参数对象
|
|
28
29
|
* @returns CDN 完整地址
|
|
29
30
|
*/
|
|
30
31
|
export default function getCdnUrl(path: string, cdnMap?: ICdnMap, region?: IRegionCode, process?: IImageProcessOptions): string;
|
package/lib/getCdnUrl/index.js
CHANGED
|
@@ -26,7 +26,7 @@ export declare function getRegionCode(): Promise<IRegionCode>;
|
|
|
26
26
|
* @param path - 图片路径
|
|
27
27
|
* @param cdnMap - CDN 地址映射表,若未提供,则使用内置 regionMap 直接与 path 进行拼接
|
|
28
28
|
* @param region - 区域代码,若未提供,则使用内置方法获取,EU 兜底
|
|
29
|
-
* @param process -
|
|
29
|
+
* @param process - 图片处理参数对象
|
|
30
30
|
* @returns CDN 完整地址
|
|
31
31
|
*/
|
|
32
32
|
export default function getCdnUrl(path: string, cdnMap?: ICdnMap, region?: IRegionCode, process?: IImageProcessOptions): string;
|
|
@@ -14,6 +14,8 @@ const regionMap = {
|
|
|
14
14
|
|
|
15
15
|
// 国外有处理参数时统一使用该域名
|
|
16
16
|
const unifiedProcessDomain = 'https://d395y9yyizm1zb.cdn5th.com';
|
|
17
|
+
// 西欧区不接受 aws 相关服务,有处理参数时使用该域名
|
|
18
|
+
const weProcessDomain = 'https://weimagedq8qoz7.cdn5th.com';
|
|
17
19
|
let _globalRegionCode;
|
|
18
20
|
const getInternalRegionCode = () => {
|
|
19
21
|
if (!_globalRegionCode) {
|
|
@@ -115,16 +117,17 @@ const appendQuery = (url, query) => {
|
|
|
115
117
|
* @param path - 图片路径
|
|
116
118
|
* @param cdnMap - CDN 地址映射表,若未提供,则使用内置 regionMap 直接与 path 进行拼接
|
|
117
119
|
* @param region - 区域代码,若未提供,则使用内置方法获取,EU 兜底
|
|
118
|
-
* @param process -
|
|
120
|
+
* @param process - 图片处理参数对象
|
|
119
121
|
* @returns CDN 完整地址
|
|
120
122
|
*/
|
|
121
123
|
export default function getCdnUrl(path, cdnMap, region, process) {
|
|
122
124
|
const regionCode = region || getInternalRegionCode();
|
|
123
125
|
const hasProcess = !!process && !isEmptyOrUndefined(process);
|
|
124
126
|
const queryPart = buildProcessQuery(regionCode, process);
|
|
127
|
+
const processDomain = regionCode === 'WE' ? weProcessDomain : unifiedProcessDomain;
|
|
125
128
|
if (isEmptyOrUndefined(cdnMap)) {
|
|
126
129
|
if (hasProcess && regionCode !== 'AY') {
|
|
127
|
-
const url = path.indexOf('/') === 0 ? "".concat(
|
|
130
|
+
const url = path.indexOf('/') === 0 ? "".concat(processDomain).concat(path) : "".concat(processDomain, "/").concat(path);
|
|
128
131
|
return appendQuery(url, queryPart);
|
|
129
132
|
}
|
|
130
133
|
return appendQuery(concatRegionOrigin(regionCode, path), queryPart);
|
|
@@ -135,7 +138,7 @@ export default function getCdnUrl(path, cdnMap, region, process) {
|
|
|
135
138
|
if (!cdnShortPath) {
|
|
136
139
|
console.warn("[App] cdn \"".concat(path, "\" is not exist."));
|
|
137
140
|
if (hasProcess && regionCode !== 'AY') {
|
|
138
|
-
const url = path.indexOf('/') === 0 ? "".concat(
|
|
141
|
+
const url = path.indexOf('/') === 0 ? "".concat(processDomain).concat(path) : "".concat(processDomain, "/").concat(path);
|
|
139
142
|
return appendQuery(url, queryPart);
|
|
140
143
|
}
|
|
141
144
|
return appendQuery(path, queryPart);
|
|
@@ -151,7 +154,7 @@ export default function getCdnUrl(path, cdnMap, region, process) {
|
|
|
151
154
|
if (hasProcess && regionCode !== 'AY') {
|
|
152
155
|
const originPrefix = regionMap[regionCode];
|
|
153
156
|
if (finalUrl.startsWith(originPrefix)) {
|
|
154
|
-
finalUrl = finalUrl.replace(originPrefix,
|
|
157
|
+
finalUrl = finalUrl.replace(originPrefix, processDomain);
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
160
|
return appendQuery(finalUrl, queryPart);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/api",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.55",
|
|
4
4
|
"description": "Ray universal api",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ray"
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"watch": "ray start --type=component"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ray-js/framework": "1.7.
|
|
33
|
-
"@ray-js/router": "1.7.
|
|
32
|
+
"@ray-js/framework": "1.7.55",
|
|
33
|
+
"@ray-js/router": "1.7.55",
|
|
34
34
|
"base64-browser": "^1.0.1",
|
|
35
35
|
"query-string": "^7.1.3"
|
|
36
36
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@ray-js/wechat": "^0.3.13"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@ray-js/cli": "1.7.
|
|
41
|
+
"@ray-js/cli": "1.7.55",
|
|
42
42
|
"art-template": "^4.13.4",
|
|
43
43
|
"fs-extra": "^10.1.0",
|
|
44
44
|
"miniprogram-api-typings": "^3.12.3",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"access": "public",
|
|
49
49
|
"registry": "https://registry.npmjs.org"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "99c603c95b6dc57833bd51784cf28c93a4d36b96"
|
|
52
52
|
}
|