@pixui-dev/pxw 0.1.31 → 0.1.33

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
@@ -74,7 +74,7 @@ module.exports.setupDevops = async function (server, app) {
74
74
  let br = cp.execSync('git branch --show-current', { stdio: 'pipe', cwd: rootDir, windowsHide: true });
75
75
  conn.send(JSON.stringify({ type: 'setDirResult', id: 'pxw', value: rootDir, result: br.toString() }));
76
76
  } catch(e) {
77
- console.log('git branch error: ', e)
77
+ console.log('git branch error')
78
78
  }
79
79
  // console.log(url.pathname, url.searchParams);
80
80
  if (url.pathname == '/notify') {
package/config/pfbs.js CHANGED
@@ -57,11 +57,16 @@ let pfbsConvert = async (ver, isJS, input, fn) => {
57
57
  xhr.onerror = () => reject(new Error('Network Error'));
58
58
  xhr.send();
59
59
  });
60
- } else if (typeof require !== 'undefined' && require('http')) {
61
- const http = require('http');
62
- console.log('http: ', url);
60
+ } else if (typeof require !== 'undefined') {
61
+ let protocol;
62
+ try {
63
+ console.log('require http/https: ', url);
64
+ protocol = url.startsWith('https') ? require('https') : require('http');
65
+ } catch (e) {
66
+ throw new Error('No supported HTTP client available');
67
+ }
63
68
  buffer = await new Promise((resolve, reject) => {
64
- http.get(url, (res) => {
69
+ protocol.get(url, (res) => {
65
70
  if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
66
71
  return resolve(this._fetchBuffer(res.headers.location));
67
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixui-dev/pxw",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "private": false,
5
5
  "directories": {
6
6
  "lib": "lib"