@pixui-dev/pxw 0.1.18 → 0.1.19

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/config/devops.js CHANGED
@@ -46,8 +46,8 @@ module.exports.setupDevops = async function (server, app) {
46
46
  }
47
47
 
48
48
  {
49
- let pp = cp.execSync('yarn', { cwd: rootDir + '/pxtest/server/', stdio: 'pipe' });
50
- console.log('yarn for pxtest server:\n', pp.toString());
49
+ // let pp = cp.execSync('yarn', { cwd: rootDir + '/pxtest/server/', stdio: 'pipe' });
50
+ // console.log('yarn for pxtest server:\n', pp.toString());
51
51
  }
52
52
 
53
53
  let subProcesses = {};
package/config/pfbs.js CHANGED
@@ -36,13 +36,51 @@ let pfbsConvert = async (ver, isJS, input, fn) => {
36
36
  let url = process.env.PFBS_DOWNLOAD_SITE || 'http://9.134.150.252:8090/dev/tools/pfbs/';
37
37
  url += path.basename(pfbs);
38
38
  try {
39
- let res = await fetch(url);
40
- let buffer = await res.arrayBuffer();
39
+ let buffer;
40
+ if (typeof fetch !== 'undefined') {
41
+ let res = await fetch(url);
42
+ buffer = await res.arrayBuffer();
43
+ }
44
+ else if (typeof XMLHttpRequest !== 'undefined') {
45
+ buffer = await new Promise((resolve, reject) => {
46
+ const xhr = new XMLHttpRequest();
47
+ xhr.open('GET', url, true);
48
+ xhr.responseType = 'arraybuffer';
49
+
50
+ xhr.onload = () => {
51
+ if (xhr.status >= 200 && xhr.status < 300) {
52
+ resolve(xhr.response);
53
+ } else {
54
+ reject(new Error(`XHR failed with status ${xhr.status}`));
55
+ }
56
+ };
57
+
58
+ xhr.onerror = () => reject(new Error('Network Error'));
59
+ xhr.send();
60
+ });
61
+ }else if (typeof require !== 'undefined' && require('http')) {
62
+ const http = require('http');
63
+ console.log('http: ', url)
64
+ buffer = await new Promise((resolve, reject) => {
65
+ http.get(url, (res) => {
66
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
67
+ return resolve(this._fetchBuffer(res.headers.location));
68
+ }
69
+
70
+ const chunks = [];
71
+ res.on('data', (chunk) => chunks.push(chunk));
72
+ res.on('end', () => resolve(Buffer.concat(chunks)));
73
+ }).on('error', reject);
74
+ });
75
+ }else {
76
+ throw new Error('No supported HTTP client available');
77
+ }
78
+
79
+ if (!fs.existsSync(path.dirname(pfbs))) fs.mkdirSync(path.dirname(pfbs));
41
80
  fs.writeFileSync(pfbs, new Uint8Array(buffer));
42
81
  fs.chmodSync(pfbs, '755');
43
- }
44
- catch (e) {
45
- console.log(e);
82
+ } catch (e) {
83
+ console.error('Request failed:', e);
46
84
  fn(input);
47
85
  return;
48
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixui-dev/pxw",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "private": false,
5
5
  "directories": {
6
6
  "lib": "lib"
@@ -101,7 +101,7 @@
101
101
  "systeminformation": "^5.25.11",
102
102
  "ts-protoc-gen": "^0.10.0",
103
103
  "tsconfig-paths-webpack-plugin": "^4.2.0",
104
- "typescript": "^5.8.2",
104
+ "typescript": "^3.9.7",
105
105
  "url-loader": "^4.1.1",
106
106
  "webpack": "^5.52.0",
107
107
  "webpack-bundle-analyzer": "^3.7.0",