pixuireactcomponents 1.3.93 → 1.3.95
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pixuireactcomponents",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.95",
|
|
4
4
|
"description": "pixui react components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"typescript": "^5.3.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@babel/core": "^7.
|
|
32
|
+
"@babel/core": "^7.24.6",
|
|
33
33
|
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
|
34
34
|
"@babel/plugin-proposal-decorators": "^7.8.3",
|
|
35
35
|
"@babel/plugin-syntax-jsx": "^7.8.3",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"@babel/plugin-transform-react-jsx": "^7.9.4",
|
|
38
38
|
"@babel/preset-env": "^7.9.6",
|
|
39
39
|
"@babel/preset-typescript": "^7.9.0",
|
|
40
|
+
"@babel/traverse": "^7.24.6",
|
|
40
41
|
"@types/jest": "25.2.1",
|
|
41
42
|
"@types/node": "13.11.1",
|
|
42
|
-
"
|
|
43
|
-
"@typescript-eslint/parser": "^2.28.0",
|
|
43
|
+
"ajv": "^8.14.0",
|
|
44
44
|
"babel-loader": "^8.1.0",
|
|
45
45
|
"babel-plugin-import": "^1.12.0",
|
|
46
46
|
"babel-plugin-jsx-pragmatic": "^1.0.2",
|
|
@@ -50,19 +50,19 @@
|
|
|
50
50
|
"comment-json": "^4.2.2",
|
|
51
51
|
"cross-env": "^7.0.3",
|
|
52
52
|
"css-loader": "^6.10.0",
|
|
53
|
-
"
|
|
54
|
-
"eslint": "^6.8.0",
|
|
55
|
-
"eslint-plugin-jest": "^23.8.2",
|
|
53
|
+
"ejs": "^3.1.10",
|
|
56
54
|
"extract-text-webpack-plugin": "^3.0.2",
|
|
57
55
|
"file-loader": "^6.0.0",
|
|
58
56
|
"fork-ts-checker-webpack-plugin": "^4.1.3",
|
|
57
|
+
"glob-parent": "^6.0.2",
|
|
59
58
|
"html-webpack-plugin": "^4.2.0",
|
|
59
|
+
"json5": "^2.2.3",
|
|
60
60
|
"less": "^3.11.1",
|
|
61
61
|
"less-loader": "^5.0.0",
|
|
62
|
+
"node-forge": "^1.3.1",
|
|
62
63
|
"prettier": "2.0.4",
|
|
63
|
-
"sass": "^1.
|
|
64
|
+
"sass": "^1.77.4",
|
|
64
65
|
"sass-loader": "^8.0.2",
|
|
65
|
-
"source-map-explorer": "^2.0.1",
|
|
66
66
|
"style-loader": "^3.3.4",
|
|
67
67
|
"ts-loader": "^9.5.1",
|
|
68
68
|
"ts-protoc-gen": "^0.10.0",
|
|
@@ -9,6 +9,7 @@ export declare namespace assetCache {
|
|
|
9
9
|
* @returns 返回本地缓存文件路径,成功后resolve资源的本地路径,失败后reject函数的url参数
|
|
10
10
|
*/
|
|
11
11
|
const cache: (url: string, force?: boolean, retryTimes?: number) => Promise<string>;
|
|
12
|
+
const getFileCachePath: (url: string) => string;
|
|
12
13
|
/**
|
|
13
14
|
*
|
|
14
15
|
* @param url 资源url
|
|
@@ -64,60 +64,47 @@ export var assetCache;
|
|
|
64
64
|
var urlWithoutParams, localPath, xhr;
|
|
65
65
|
var _this = this;
|
|
66
66
|
return __generator(this, function (_a) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
console.log('cacheAsset
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
67
|
+
if (!isJssdkEnv) {
|
|
68
|
+
console.log('非jssdk环境');
|
|
69
|
+
reject(url);
|
|
70
|
+
return [2 /*return*/];
|
|
71
|
+
}
|
|
72
|
+
urlWithoutParams = url.split('?')[0];
|
|
73
|
+
localPath = getLocalPath(urlWithoutParams);
|
|
74
|
+
if (!localPath) {
|
|
75
|
+
console.log('getLocalPath failed');
|
|
76
|
+
reject(url);
|
|
77
|
+
return [2 /*return*/];
|
|
78
|
+
}
|
|
79
|
+
console.log('cacheAsset getlocalPath', localPath);
|
|
80
|
+
if (!force) {
|
|
81
|
+
if (OPLib.fileExists(localPath)) {
|
|
82
|
+
console.log('cacheAsset file exist', localPath);
|
|
83
|
+
resolve(localPath);
|
|
84
|
+
return [2 /*return*/];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
console.log('cacheAsset download start -- ', url, localPath);
|
|
88
|
+
xhr = new XMLHttpRequest();
|
|
89
|
+
xhr.open('GET', url, true);
|
|
90
|
+
xhr.responseType = 'arraybuffer';
|
|
91
|
+
xhr.onload = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
92
|
+
return __generator(this, function (_a) {
|
|
93
|
+
if (xhr.status === 200) {
|
|
94
|
+
console.log('cacheAsset xhr statue=200', url, localPath);
|
|
95
|
+
// let buf = Buffer.from(xhr.response, 'binary').buffer;
|
|
96
|
+
if (localPath) {
|
|
97
|
+
OPLib.saveToFile(localPath, xhr.response);
|
|
86
98
|
resolve(localPath);
|
|
99
|
+
return [2 /*return*/];
|
|
87
100
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
xhr = new XMLHttpRequest();
|
|
91
|
-
xhr.open('GET', url, true);
|
|
92
|
-
xhr.responseType = 'arraybuffer';
|
|
93
|
-
xhr.onload = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
94
|
-
return __generator(this, function (_a) {
|
|
95
|
-
if (xhr.status === 200) {
|
|
96
|
-
console.log('cacheAsset xhr statue=200', url, localPath);
|
|
97
|
-
// let buf = Buffer.from(xhr.response, 'binary').buffer;
|
|
98
|
-
if (localPath) {
|
|
99
|
-
OPLib.saveToFile(localPath, xhr.response);
|
|
100
|
-
resolve(localPath);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
reject(url);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
console.warn('cacheAsset xhr statue!=200', xhr.status);
|
|
108
|
-
if (retryTimes > 0) {
|
|
109
|
-
console.log('retry cacheAsset', retryTimes);
|
|
110
|
-
assetCache.cache(url, force, retryTimes - 1).then(resolve, reject);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
reject(url);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
101
|
+
else {
|
|
102
|
+
reject(url);
|
|
116
103
|
return [2 /*return*/];
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
console.warn('cacheAsset
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
console.warn('cacheAsset xhr statue!=200', xhr.status);
|
|
121
108
|
if (retryTimes > 0) {
|
|
122
109
|
console.log('retry cacheAsset', retryTimes);
|
|
123
110
|
assetCache.cache(url, force, retryTimes - 1).then(resolve, reject);
|
|
@@ -125,15 +112,46 @@ export var assetCache;
|
|
|
125
112
|
else {
|
|
126
113
|
reject(url);
|
|
127
114
|
}
|
|
128
|
-
}
|
|
129
|
-
xhr.send();
|
|
115
|
+
}
|
|
130
116
|
return [2 /*return*/];
|
|
131
|
-
|
|
117
|
+
});
|
|
118
|
+
}); };
|
|
119
|
+
xhr.onerror = function () {
|
|
120
|
+
console.warn('cacheAsset XHR error', xhr.status);
|
|
121
|
+
if (retryTimes > 0) {
|
|
122
|
+
console.log('retry cacheAsset', retryTimes);
|
|
123
|
+
assetCache.cache(url, force, retryTimes - 1).then(resolve, reject);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
reject(url);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
xhr.send();
|
|
130
|
+
return [2 /*return*/];
|
|
132
131
|
});
|
|
133
132
|
}); })];
|
|
134
133
|
});
|
|
135
134
|
});
|
|
136
135
|
};
|
|
136
|
+
assetCache.getFileCachePath = function (url) {
|
|
137
|
+
console.log('getCachePath', url);
|
|
138
|
+
if (!isJssdkEnv) {
|
|
139
|
+
console.log('非jssdk环境');
|
|
140
|
+
return '';
|
|
141
|
+
}
|
|
142
|
+
var urlWithoutParams = url.split('?')[0];
|
|
143
|
+
var localPath = getLocalPath(urlWithoutParams);
|
|
144
|
+
if (!localPath) {
|
|
145
|
+
console.log('getLocalPath failed');
|
|
146
|
+
return '';
|
|
147
|
+
}
|
|
148
|
+
if (OPLib.fileExists(localPath)) {
|
|
149
|
+
console.log('getCachePath success', localPath);
|
|
150
|
+
return localPath;
|
|
151
|
+
}
|
|
152
|
+
console.log('getCachePath failed', localPath);
|
|
153
|
+
return '';
|
|
154
|
+
};
|
|
137
155
|
/**
|
|
138
156
|
*
|
|
139
157
|
* @param url 资源url
|
|
@@ -179,17 +197,19 @@ export var assetCache;
|
|
|
179
197
|
xhr.send();
|
|
180
198
|
});
|
|
181
199
|
};
|
|
182
|
-
var getLocalPath = function (url) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
200
|
+
var getLocalPath = function (url) {
|
|
201
|
+
console.log('getLocalPath', url);
|
|
202
|
+
var cachePath = OPLib.getCachePath();
|
|
203
|
+
if (!cachePath) {
|
|
204
|
+
console.warn('getLocalPath failed', url);
|
|
205
|
+
return '';
|
|
206
|
+
}
|
|
207
|
+
var filePath = path.join(cachePath, 'assetcache');
|
|
208
|
+
//检查assetcache文件夹
|
|
209
|
+
if (!OPLib.dirExists(filePath)) {
|
|
210
|
+
OPLib.makeDir(filePath);
|
|
211
|
+
}
|
|
212
|
+
var fileName = tools.getHashStr(assetPrefix + url) + path.extname(url);
|
|
213
|
+
return path.join(filePath, fileName || '');
|
|
214
|
+
};
|
|
195
215
|
})(assetCache || (assetCache = {}));
|