@pixui-dev/pxw 0.1.18 → 0.1.20

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
  }
@@ -0,0 +1,85 @@
1
+ import * as preact from 'preact';
2
+
3
+ export function route(url: string, replace?: boolean): boolean;
4
+ export function route(options: { url: string; replace?: boolean }): boolean;
5
+
6
+ export function getCurrentUrl(): string;
7
+
8
+ export interface Location {
9
+ pathname: string;
10
+ search: string;
11
+ }
12
+
13
+ export interface CustomHistory {
14
+ listen(callback: (location: Location) => void): () => void;
15
+ location: Location;
16
+ push(path: string): void;
17
+ replace(path: string): void;
18
+ }
19
+
20
+ export interface RoutableProps {
21
+ path?: string;
22
+ default?: boolean;
23
+ }
24
+
25
+ export interface RouterOnChangeArgs {
26
+ router: Router;
27
+ url: string;
28
+ previous?: string;
29
+ active: preact.VNode[];
30
+ current: preact.VNode;
31
+ }
32
+
33
+ export interface RouterProps extends RoutableProps {
34
+ history?: CustomHistory;
35
+ static?: boolean;
36
+ url?: string;
37
+ onChange?: (args: RouterOnChangeArgs) => void;
38
+ }
39
+
40
+ export class Router extends preact.Component<RouterProps, {}> {
41
+ canRoute(url: string): boolean;
42
+ getMatchingChildren(
43
+ children: preact.VNode[],
44
+ url: string,
45
+ invoke: boolean
46
+ ): preact.VNode[];
47
+ routeTo(url: string): boolean;
48
+ render(props: RouterProps, {}): preact.VNode;
49
+ }
50
+
51
+ export const subscribers: Array<(url: string) => void>
52
+
53
+ type AnyComponent<Props> =
54
+ | preact.FunctionalComponent<Props>
55
+ | preact.ComponentConstructor<Props, any>;
56
+
57
+ export interface RouteProps<Props> extends RoutableProps {
58
+ component: AnyComponent<Props>;
59
+ }
60
+
61
+ export function Route<Props>(
62
+ props: RouteProps<Props> & Partial<Props>
63
+ ): preact.VNode;
64
+
65
+ export function Link(props: {activeClassName?: string} & preact.JSX.HTMLAttributes): preact.VNode;
66
+
67
+ export class Match extends preact.Component<RoutableProps, {}> {
68
+ render(): preact.VNode;
69
+ }
70
+
71
+ export interface LinkProps extends preact.JSX.HTMLAttributes {
72
+ activeClassName?: string;
73
+ children?: preact.ComponentChildren;
74
+ }
75
+
76
+ export function Link(props: LinkProps): preact.VNode;
77
+
78
+ declare module 'preact' {
79
+ export interface Attributes extends RoutableProps {}
80
+ }
81
+
82
+ export{
83
+ Router,
84
+ Match
85
+ };
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.20",
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",
File without changes
File without changes
File without changes