@ray-js/api 0.6.30 → 0.6.32
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 +1 -0
- package/lib/getCdnUrl/index.js +4 -0
- package/lib/getCdnUrl/index.thing.d.ts +1 -0
- package/lib/getCdnUrl/index.thing.js +28 -0
- package/lib/getCdnUrl/index.wechat.d.ts +1 -0
- package/lib/getCdnUrl/index.wechat.js +4 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +5 -5
@@ -0,0 +1 @@
|
|
1
|
+
export default function getCdnUrl(path: string): string;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function getCdnUrl(path: string, cdnMap?: Record<string, string>): string;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
export default function getCdnUrl(path, cdnMap) {
|
2
|
+
if (!cdnMap) {
|
3
|
+
console.warn('请传入cdnMap');
|
4
|
+
return path;
|
5
|
+
}
|
6
|
+
|
7
|
+
var regionCode = 'EU';
|
8
|
+
ty.getAppInfo().then(function (res) {
|
9
|
+
regionCode = res.regionCode;
|
10
|
+
});
|
11
|
+
var region = {
|
12
|
+
AY: 'images.tuyacn.com',
|
13
|
+
AZ: 'usimagesd1448c85ulz2o4.cdn5th.com',
|
14
|
+
EU: 'euimagesd2h2yqnfpu4gl5.cdn5th.com',
|
15
|
+
IN: 'inimagesd1jqokb9wptk2t.cdn5th.com',
|
16
|
+
RU: 'euimagesd2h2yqnfpu4gl5.cdn5th.com',
|
17
|
+
WE: 'd2h2yqnfpu4gl5.cdn5th.com',
|
18
|
+
UE: 'usimagesd1448c85ulz2o4.cdn5th.com'
|
19
|
+
}[regionCode];
|
20
|
+
var cdnShortPath = cdnMap[path];
|
21
|
+
|
22
|
+
if (!cdnShortPath) {
|
23
|
+
console.warn('[App] cdn "' + path + '" is not exist.');
|
24
|
+
return path;
|
25
|
+
}
|
26
|
+
|
27
|
+
return 'https://' + region + '/' + cdnShortPath;
|
28
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function getCdnUrl(path: string): string;
|
package/lib/index.d.ts
CHANGED
@@ -20,6 +20,7 @@ export { default as showTabBar } from './showTabBar';
|
|
20
20
|
export { default as switchTab } from './switchTab';
|
21
21
|
export { default as onNavigationBarBack } from './onNavigationBarBack';
|
22
22
|
export { default as setNavigationBarBack } from './setNavigationBarBack';
|
23
|
+
export { default as getCdnUrl } from './getCdnUrl';
|
23
24
|
/**
|
24
25
|
* 提供 glboal-api 将 wx / ty 对象暴露出去,供给业务在Ray为显示导出api时进行快速响应开发。
|
25
26
|
*/
|
package/lib/index.js
CHANGED
@@ -20,6 +20,7 @@ export { default as showTabBar } from './showTabBar';
|
|
20
20
|
export { default as switchTab } from './switchTab';
|
21
21
|
export { default as onNavigationBarBack } from './onNavigationBarBack';
|
22
22
|
export { default as setNavigationBarBack } from './setNavigationBarBack';
|
23
|
+
export { default as getCdnUrl } from './getCdnUrl';
|
23
24
|
/**
|
24
25
|
* 提供 glboal-api 将 wx / ty 对象暴露出去,供给业务在Ray为显示导出api时进行快速响应开发。
|
25
26
|
*/
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/api",
|
3
|
-
"version": "0.6.
|
3
|
+
"version": "0.6.32",
|
4
4
|
"description": "Ray universal api",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -26,12 +26,12 @@
|
|
26
26
|
"build:kit:api": "node scripts/api-creator.mjs"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@ray-js/framework": "^0.6.
|
29
|
+
"@ray-js/framework": "^0.6.32",
|
30
30
|
"@ray-js/panel-sdk": "^1.2.2",
|
31
|
-
"@ray-js/router": "^0.6.
|
31
|
+
"@ray-js/router": "^0.6.32"
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
34
|
-
"@ray-js/cli": "^0.6.
|
34
|
+
"@ray-js/cli": "^0.6.32",
|
35
35
|
"art-template": "^4.13.2",
|
36
36
|
"fs-extra": "^10.1.0",
|
37
37
|
"miniprogram-api-typings": "^3.4.3",
|
@@ -46,6 +46,6 @@
|
|
46
46
|
"email": "tuyafe@tuya.com"
|
47
47
|
}
|
48
48
|
],
|
49
|
-
"gitHead": "
|
49
|
+
"gitHead": "cca49d95837e248eb6471a3802a7f1461d482f71",
|
50
50
|
"repository": {}
|
51
51
|
}
|