@pixui-dev/pxw 0.1.21 → 0.1.23
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/bin/pxw.js +192 -199
- package/bin/wpbuild.js +10 -10
- package/config/default.conf +20 -20
- package/config/devops.js +360 -372
- package/config/h5es.js +10 -10
- package/config/index.html +183 -183
- package/config/pfbs.js +251 -245
- package/config/util.js +136 -140
- package/config/webpack.js +324 -325
- package/lib/assets/check.html +62 -62
- package/lib/assets/preact.js +4354 -4354
- package/lib/check/main.less +62 -62
- package/lib/check/main.tsx +41 -41
- package/lib/check/tool.js +3 -3
- package/lib/check/util.tsx +110 -110
- package/lib/grpc-web/dist/ChunkParser.js +117 -117
- package/lib/grpc-web/dist/Code.js +58 -58
- package/lib/grpc-web/dist/client.js +299 -299
- package/lib/grpc-web/dist/debug.js +16 -16
- package/lib/grpc-web/dist/detach.js +7 -7
- package/lib/grpc-web/dist/index.js +29 -29
- package/lib/grpc-web/dist/invoke.js +32 -32
- package/lib/grpc-web/dist/message.js +3 -3
- package/lib/grpc-web/dist/metadata.js +5 -5
- package/lib/grpc-web/dist/service.js +3 -3
- package/lib/grpc-web/dist/transports/Transport.js +15 -15
- package/lib/grpc-web/dist/transports/http/fetch.js +117 -117
- package/lib/grpc-web/dist/transports/http/http.js +15 -15
- package/lib/grpc-web/dist/transports/http/xhr.js +136 -136
- package/lib/grpc-web/dist/transports/http/xhrUtil.js +36 -36
- package/lib/grpc-web/dist/transports/websocket/websocket.js +95 -95
- package/lib/grpc-web/dist/typings/ChunkParser.d.ts +17 -17
- package/lib/grpc-web/dist/typings/Code.d.ts +20 -20
- package/lib/grpc-web/dist/typings/client.d.ts +25 -25
- package/lib/grpc-web/dist/typings/debug.d.ts +1 -1
- package/lib/grpc-web/dist/typings/detach.d.ts +1 -1
- package/lib/grpc-web/dist/typings/index.d.ts +45 -45
- package/lib/grpc-web/dist/typings/invoke.d.ts +20 -20
- package/lib/grpc-web/dist/typings/message.d.ts +8 -8
- package/lib/grpc-web/dist/typings/metadata.d.ts +2 -2
- package/lib/grpc-web/dist/typings/service.d.ts +16 -16
- package/lib/grpc-web/dist/typings/transports/Transport.d.ts +22 -22
- package/lib/grpc-web/dist/typings/transports/http/fetch.d.ts +6 -6
- package/lib/grpc-web/dist/typings/transports/http/http.d.ts +5 -5
- package/lib/grpc-web/dist/typings/transports/http/xhr.d.ts +27 -27
- package/lib/grpc-web/dist/typings/transports/http/xhrUtil.d.ts +3 -3
- package/lib/grpc-web/dist/typings/transports/websocket/websocket.d.ts +2 -2
- package/lib/grpc-web/dist/typings/unary.d.ts +23 -23
- package/lib/grpc-web/dist/typings/util.d.ts +2 -2
- package/lib/grpc-web/dist/unary.js +44 -44
- package/lib/grpc-web/dist/util.js +11 -11
- package/lib/grpcTransport/PixHttp2Transport.ts +107 -107
- package/lib/grpcTransport/PixLuaTransport.ts +82 -82
- package/lib/h5es-types/v1.9.2/h5es.d.ts +1698 -1698
- package/lib/h5es-types/v3.5.0/h5es.d.ts +1788 -1788
- package/lib/pi_component/tinyList/tinyList.js +483 -483
- package/lib/pi_component/tinyList/tinyList.tsx +517 -517
- package/lib/preact-router.js +395 -395
- package/lib/preact.js +4355 -4355
- package/lib/preact.tq.js +4385 -4385
- package/lib/react-window/src/FixedSizeGrid.js +172 -172
- package/lib/react-window/src/FixedSizeList.js +91 -91
- package/lib/react-window/src/VariableSizeGrid.js +329 -329
- package/lib/react-window/src/VariableSizeList.js +231 -231
- package/lib/react-window/src/__tests__/FixedSizeGrid.js +942 -942
- package/lib/react-window/src/__tests__/FixedSizeList.js +749 -749
- package/lib/react-window/src/__tests__/VariableSizeGrid.js +598 -598
- package/lib/react-window/src/__tests__/VariableSizeList.js +345 -345
- package/lib/react-window/src/__tests__/__snapshots__/FixedSizeGrid.js.snap +912 -912
- package/lib/react-window/src/__tests__/__snapshots__/FixedSizeList.js.snap +568 -568
- package/lib/react-window/src/__tests__/__snapshots__/VariableSizeGrid.js.snap +542 -542
- package/lib/react-window/src/__tests__/__snapshots__/VariableSizeList.js.snap +331 -331
- package/lib/react-window/src/__tests__/areEqual.js +28 -28
- package/lib/react-window/src/__tests__/shouldComponentUpdate.js +32 -32
- package/lib/react-window/src/areEqual.js +13 -13
- package/lib/react-window/src/createGridComponent.js +657 -657
- package/lib/react-window/src/createListComponent.js +574 -574
- package/lib/react-window/src/domHelpers.js +69 -69
- package/lib/react-window/src/index.js +9 -9
- package/lib/react-window/src/shallowDiffers.js +17 -17
- package/lib/react-window/src/shouldComponentUpdate.js +11 -11
- package/lib/react-window/src/test.js.flow +382 -382
- package/lib/react-window/src/timer.js +36 -36
- package/lib/types/dom.ts +17 -17
- package/lib/types/ext.d.ts +81 -81
- package/lib/types/preact/css.d.ts +7476 -7476
- package/lib/types/preact/index.d.ts +340 -340
- package/lib/types/preact/internal.d.ts +94 -94
- package/lib/types/preact/jsx.d.ts +320 -309
- package/lib/types/preact-router/index.d.ts +84 -84
- package/package.json +114 -113
- package/scripts/pack.js +40 -40
- package/scripts/postinstall.js +12 -12
- package/scripts/run-pxw.js +13 -13
- package/tsconfig.json +30 -30
package/config/util.js
CHANGED
|
@@ -1,140 +1,136 @@
|
|
|
1
|
-
let fs = require('fs');
|
|
2
|
-
let cp = require('child_process');
|
|
3
|
-
let path = require('path');
|
|
4
|
-
let pfbs = require('./pfbs');
|
|
5
|
-
|
|
6
|
-
module.exports.getLocalIP = function () {
|
|
7
|
-
let os = require('os');
|
|
8
|
-
let ifaces = os.networkInterfaces();
|
|
9
|
-
|
|
10
|
-
let ipList = [];
|
|
11
|
-
Object.keys(ifaces).forEach(function (ifname) {
|
|
12
|
-
let alias = 0;
|
|
13
|
-
|
|
14
|
-
ifaces[ifname].forEach(function (iface) {
|
|
15
|
-
// console.log(iface);
|
|
16
|
-
if ('IPv4' !== iface.family || iface.internal !== false) {
|
|
17
|
-
// skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
if (iface.address.indexOf('255') >= 0) return;
|
|
21
|
-
if (iface.address.indexOf('169.254') >= 0) return;
|
|
22
|
-
ipList.push(iface.address);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
console.log('iplist', ipList);
|
|
26
|
-
return ipList;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
module.exports.readRegKey = function (path, key) {
|
|
30
|
-
const powerShellScript = `
|
|
31
|
-
$ErrorActionPreference = 'Stop'
|
|
32
|
-
$keyPath = "HKLM:\\${path}"
|
|
33
|
-
$key = "${key}"
|
|
34
|
-
|
|
35
|
-
try {
|
|
36
|
-
$value = Get-ItemProperty -Path $keyPath -Name $key
|
|
37
|
-
if ($value -ne $null) {
|
|
38
|
-
Write-Output $value.$key
|
|
39
|
-
} else {
|
|
40
|
-
Write-Error "Registry value not found."
|
|
41
|
-
}
|
|
42
|
-
} catch {
|
|
43
|
-
Write-Error "Error accessing the registry: $_"
|
|
44
|
-
}
|
|
45
|
-
`;
|
|
46
|
-
try {
|
|
47
|
-
let out = cp.execSync(powerShellScript, {
|
|
48
|
-
shell: 'powershell.exe',
|
|
49
|
-
windowsHide: true,
|
|
50
|
-
});
|
|
51
|
-
return out.toString();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
let
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
projectConfig
|
|
74
|
-
//
|
|
75
|
-
// p.
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
updateTypeRoots
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
h5esType = h5esTypeRoot.substring(slashIndex + 1);
|
|
138
|
-
}
|
|
139
|
-
return h5esType;
|
|
140
|
-
};
|
|
1
|
+
let fs = require('fs');
|
|
2
|
+
let cp = require('child_process');
|
|
3
|
+
let path = require('path');
|
|
4
|
+
let pfbs = require('./pfbs');
|
|
5
|
+
|
|
6
|
+
module.exports.getLocalIP = function () {
|
|
7
|
+
let os = require('os');
|
|
8
|
+
let ifaces = os.networkInterfaces();
|
|
9
|
+
|
|
10
|
+
let ipList = [];
|
|
11
|
+
Object.keys(ifaces).forEach(function (ifname) {
|
|
12
|
+
let alias = 0;
|
|
13
|
+
|
|
14
|
+
ifaces[ifname].forEach(function (iface) {
|
|
15
|
+
// console.log(iface);
|
|
16
|
+
if ('IPv4' !== iface.family || iface.internal !== false) {
|
|
17
|
+
// skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (iface.address.indexOf('255') >= 0) return;
|
|
21
|
+
if (iface.address.indexOf('169.254') >= 0) return;
|
|
22
|
+
ipList.push(iface.address);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
console.log('iplist', ipList);
|
|
26
|
+
return ipList;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
module.exports.readRegKey = function (path, key) {
|
|
30
|
+
const powerShellScript = `
|
|
31
|
+
$ErrorActionPreference = 'Stop'
|
|
32
|
+
$keyPath = "HKLM:\\${path}"
|
|
33
|
+
$key = "${key}"
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
$value = Get-ItemProperty -Path $keyPath -Name $key
|
|
37
|
+
if ($value -ne $null) {
|
|
38
|
+
Write-Output $value.$key
|
|
39
|
+
} else {
|
|
40
|
+
Write-Error "Registry value not found."
|
|
41
|
+
}
|
|
42
|
+
} catch {
|
|
43
|
+
Write-Error "Error accessing the registry: $_"
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
try {
|
|
47
|
+
let out = cp.execSync(powerShellScript, {
|
|
48
|
+
shell: 'powershell.exe',
|
|
49
|
+
windowsHide: true,
|
|
50
|
+
});
|
|
51
|
+
return out.toString();
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error('Error executing PowerShell script:', error.message);
|
|
54
|
+
return '';
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
module.exports.isInParalles = function () {
|
|
59
|
+
if (process.platform != 'win32') return false;
|
|
60
|
+
let v = module.exports.readRegKey('SYSTEM\\CurrentControlSet\\Control\\SystemInformation', 'SystemProductName');
|
|
61
|
+
return /Parallels/.test(v);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
let projectConfig;
|
|
65
|
+
module.exports.loadProjectConfig = function () {
|
|
66
|
+
if (projectConfig) return projectConfig;
|
|
67
|
+
let pienv = {};
|
|
68
|
+
try {
|
|
69
|
+
let cwd = process.cwd();
|
|
70
|
+
let ep = cwd + '/entry';
|
|
71
|
+
console.log('read entry.js', ep);
|
|
72
|
+
projectConfig = require(ep);
|
|
73
|
+
// projectConfig.pages.forEach((p) => {
|
|
74
|
+
// p.entry = `${cwd}/${p.entry}`;
|
|
75
|
+
// p.template = `${cwd}/${p.template}`;
|
|
76
|
+
// appDef.push(p);
|
|
77
|
+
// });
|
|
78
|
+
|
|
79
|
+
let env = projectConfig.env;
|
|
80
|
+
|
|
81
|
+
Object.entries(env || {}).forEach(([k, v]) => {
|
|
82
|
+
pienv['process.env.' + k] = JSON.stringify(v);
|
|
83
|
+
});
|
|
84
|
+
} catch (e) {
|
|
85
|
+
console.warn('read entry.js failed');
|
|
86
|
+
if (!/Cannot find module/.test(e.message)) {
|
|
87
|
+
console.error(e);
|
|
88
|
+
}
|
|
89
|
+
projectConfig = { pages: [] };
|
|
90
|
+
} finally {
|
|
91
|
+
}
|
|
92
|
+
return projectConfig;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
module.exports.getH5esType = function () {
|
|
96
|
+
const { parse } = require('comment-json');
|
|
97
|
+
const tsconfigPath = path.resolve(process.cwd(), 'tsconfig.json');
|
|
98
|
+
const fileContent = fs.readFileSync(tsconfigPath, 'utf8');
|
|
99
|
+
const tsconfig = parse(fileContent);
|
|
100
|
+
tsconfig.compilerOptions = tsconfig.compilerOptions || {};
|
|
101
|
+
const existingTypeRoots = tsconfig.compilerOptions.typeRoots || [];
|
|
102
|
+
const h5esTypeRoot = existingTypeRoots.find((root) => root.includes('h5es-types'));
|
|
103
|
+
let slashIndex = h5esTypeRoot.lastIndexOf('/');
|
|
104
|
+
if (slashIndex !== -1) {
|
|
105
|
+
h5esType = h5esTypeRoot.substring(slashIndex + 1);
|
|
106
|
+
}
|
|
107
|
+
return h5esType;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
module.exports.setH5esType = function (newType) {
|
|
111
|
+
const { stringify, parse } = require('comment-json');
|
|
112
|
+
const tsconfigPath = path.resolve(process.cwd(), 'tsconfig.json');
|
|
113
|
+
const fileContent = fs.readFileSync(tsconfigPath, 'utf8');
|
|
114
|
+
const tsconfig = parse(fileContent);
|
|
115
|
+
tsconfig.compilerOptions = tsconfig.compilerOptions || {};
|
|
116
|
+
const existingTypeRoots = tsconfig.compilerOptions.typeRoots || [];
|
|
117
|
+
let h5esTypeRoot = existingTypeRoots.find((root) => root.includes('h5es-types'));
|
|
118
|
+
const updateTypeRoots = existingTypeRoots.filter((root) => !root.includes('h5es-types'));
|
|
119
|
+
if (h5esTypeRoot === undefined || h5esTypeRoot != newType) {
|
|
120
|
+
updateTypeRoots.push(newType);
|
|
121
|
+
console.log('newType ', newType);
|
|
122
|
+
h5esTypeRoot = newType;
|
|
123
|
+
tsconfig.compilerOptions.typeRoots = updateTypeRoots;
|
|
124
|
+
fs.writeFileSync(tsconfigPath, stringify(tsconfig, null, 2));
|
|
125
|
+
try {
|
|
126
|
+
cp.execSync('npx prettier-eslint --write tsconfig.json', {});
|
|
127
|
+
} catch (e) {
|
|
128
|
+
console.error('prettier-eslint failed:', e.message);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
let slashIndex = h5esTypeRoot.lastIndexOf('/');
|
|
132
|
+
if (slashIndex !== -1) {
|
|
133
|
+
h5esType = h5esTypeRoot.substring(slashIndex + 1);
|
|
134
|
+
}
|
|
135
|
+
return h5esType;
|
|
136
|
+
};
|