@ray-js/api 1.3.17 → 1.3.18
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.
@@ -1,3 +1,3 @@
|
|
1
1
|
export declare function getRegionCode(): Promise<string>;
|
2
|
-
export default function getCdnUrl(path: string, cdnMap?: Record<string, string
|
3
|
-
export declare function getCdnUrlAsync(path: string, cdnMap?: Record<string, string
|
2
|
+
export default function getCdnUrl(path: string, cdnMap?: Record<string, string>, region?: string): string;
|
3
|
+
export declare function getCdnUrlAsync(path: string, cdnMap?: Record<string, string>, region?: string): Promise<string>;
|
@@ -29,7 +29,7 @@ ty.getAppInfo({
|
|
29
29
|
regionCode = res.regionCode;
|
30
30
|
}
|
31
31
|
});
|
32
|
-
export default function getCdnUrl(path, cdnMap) {
|
32
|
+
export default function getCdnUrl(path, cdnMap, region) {
|
33
33
|
if (!cdnMap) {
|
34
34
|
console.warn('请传入cdnMap');
|
35
35
|
return path;
|
@@ -42,7 +42,7 @@ export default function getCdnUrl(path, cdnMap) {
|
|
42
42
|
return path;
|
43
43
|
}
|
44
44
|
|
45
|
-
var cdnPath = 'https://' + regionMap[regionCode] + '/' + cdnShortPath;
|
45
|
+
var cdnPath = 'https://' + regionMap[region || regionCode] + '/' + cdnShortPath;
|
46
46
|
return cdnPath;
|
47
47
|
}
|
48
48
|
export function getCdnUrlAsync() {
|
@@ -50,7 +50,7 @@ export function getCdnUrlAsync() {
|
|
50
50
|
}
|
51
51
|
|
52
52
|
function _getCdnUrlAsync() {
|
53
|
-
_getCdnUrlAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(path, cdnMap) {
|
53
|
+
_getCdnUrlAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(path, cdnMap, region) {
|
54
54
|
var _regionCode, cdnShortPath, cdnPath;
|
55
55
|
|
56
56
|
return _regeneratorRuntime.wrap(function (_context) {
|
@@ -67,41 +67,52 @@ function _getCdnUrlAsync() {
|
|
67
67
|
|
68
68
|
case 3:
|
69
69
|
_regionCode = 'EU';
|
70
|
-
|
71
|
-
|
70
|
+
|
71
|
+
if (!region) {
|
72
|
+
_context.next = 8;
|
73
|
+
break;
|
74
|
+
}
|
75
|
+
|
76
|
+
_regionCode = region;
|
77
|
+
_context.next = 17;
|
78
|
+
break;
|
79
|
+
|
80
|
+
case 8:
|
81
|
+
_context.prev = 8;
|
82
|
+
_context.next = 11;
|
72
83
|
return getRegionCode();
|
73
84
|
|
74
|
-
case
|
85
|
+
case 11:
|
75
86
|
_regionCode = _context.sent;
|
76
|
-
_context.next =
|
87
|
+
_context.next = 17;
|
77
88
|
break;
|
78
89
|
|
79
|
-
case
|
80
|
-
_context.prev =
|
81
|
-
_context.t0 = _context["catch"](
|
90
|
+
case 14:
|
91
|
+
_context.prev = 14;
|
92
|
+
_context.t0 = _context["catch"](8);
|
82
93
|
console.warn('[App] getRegionCode error, use default region EU', _context.t0);
|
83
94
|
|
84
|
-
case
|
95
|
+
case 17:
|
85
96
|
cdnShortPath = cdnMap[path];
|
86
97
|
|
87
98
|
if (cdnShortPath) {
|
88
|
-
_context.next =
|
99
|
+
_context.next = 21;
|
89
100
|
break;
|
90
101
|
}
|
91
102
|
|
92
103
|
console.warn('[App] cdn "' + path + '" is not exist.');
|
93
104
|
return _context.abrupt("return", path);
|
94
105
|
|
95
|
-
case
|
106
|
+
case 21:
|
96
107
|
cdnPath = 'https://' + regionMap[_regionCode] + '/' + cdnShortPath;
|
97
108
|
return _context.abrupt("return", cdnPath);
|
98
109
|
|
99
|
-
case
|
110
|
+
case 23:
|
100
111
|
case "end":
|
101
112
|
return _context.stop();
|
102
113
|
}
|
103
114
|
}
|
104
|
-
}, _callee, null, [[
|
115
|
+
}, _callee, null, [[8, 14]]);
|
105
116
|
}));
|
106
117
|
return _getCdnUrlAsync.apply(this, arguments);
|
107
118
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/api",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.18",
|
4
4
|
"description": "Ray universal api",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -26,13 +26,13 @@
|
|
26
26
|
"build:kit:api": "node scripts/api-creator.mjs"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@ray-js/framework": "^1.3.
|
30
|
-
"@ray-js/router": "^1.3.
|
29
|
+
"@ray-js/framework": "^1.3.18",
|
30
|
+
"@ray-js/router": "^1.3.18",
|
31
31
|
"@ray-js/wechat": "^0.0.16",
|
32
32
|
"base64-browser": "^1.0.1"
|
33
33
|
},
|
34
34
|
"devDependencies": {
|
35
|
-
"@ray-js/cli": "^1.3.
|
35
|
+
"@ray-js/cli": "^1.3.18",
|
36
36
|
"art-template": "^4.13.2",
|
37
37
|
"fs-extra": "^10.1.0",
|
38
38
|
"miniprogram-api-typings": "^3.4.3",
|
@@ -44,6 +44,6 @@
|
|
44
44
|
"email": "tuyafe@tuya.com"
|
45
45
|
}
|
46
46
|
],
|
47
|
-
"gitHead": "
|
47
|
+
"gitHead": "62c2bc92b939d0be30b658263a8f455561233602",
|
48
48
|
"repository": {}
|
49
49
|
}
|