webclaw-dashboard-server 1.4.2
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/start.js +5 -0
- package/dist/dashboard-server.jsc +0 -0
- package/lib/platform-loader.js +45 -0
- package/package.json +37 -0
package/bin/start.js
ADDED
|
Binary file
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
const PLATFORM_PACKAGES = [
|
|
6
|
+
{ platform: 'linux', arch: 'x64', packageName: 'webclaw-dashboard-server-linux-x64' },
|
|
7
|
+
{ platform: 'linux', arch: 'arm64', packageName: 'webclaw-dashboard-server-linux-arm64' }
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
function getPlatformPackageName(platform = process.platform, arch = process.arch) {
|
|
11
|
+
const match = PLATFORM_PACKAGES.find(item => item.platform === platform && item.arch === arch);
|
|
12
|
+
return match ? match.packageName : null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function loadFallbackBundle() {
|
|
16
|
+
require('bytenode');
|
|
17
|
+
require(path.join(__dirname, '..', 'dist', 'dashboard-server.jsc'));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function loadCurrentPlatformPackage() {
|
|
21
|
+
const packageName = getPlatformPackageName();
|
|
22
|
+
if (!packageName) {
|
|
23
|
+
throw new Error(`Unsupported platform: ${process.platform}/${process.arch}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
return require(packageName);
|
|
28
|
+
} catch (error) {
|
|
29
|
+
const missingCurrentPackage = error && error.code === 'MODULE_NOT_FOUND' &&
|
|
30
|
+
typeof error.message === 'string' &&
|
|
31
|
+
error.message.includes(`'${packageName}'`);
|
|
32
|
+
|
|
33
|
+
if (!missingCurrentPackage) {
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return loadFallbackBundle();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
module.exports = {
|
|
42
|
+
PLATFORM_PACKAGES,
|
|
43
|
+
getPlatformPackageName,
|
|
44
|
+
loadCurrentPlatformPackage,
|
|
45
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "webclaw-dashboard-server",
|
|
3
|
+
"version": "1.4.2",
|
|
4
|
+
"description": "Dashboard server and proxy for webclaw browser dev environment",
|
|
5
|
+
"bin": {
|
|
6
|
+
"webclaw-dashboard-server": "./bin/start.js",
|
|
7
|
+
"webcode-dashboard-server": "./bin/start.js"
|
|
8
|
+
},
|
|
9
|
+
"config": {
|
|
10
|
+
"node_version": "22.22.1"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "node scripts/build.js",
|
|
14
|
+
"build:docker": "docker run --rm -v $(pwd):/work -w /work node:$npm_package_config_node_version sh -c 'npm install --omit=optional && node scripts/build.js'",
|
|
15
|
+
"prepare:platform-package": "node scripts/prepare-platform-package.js",
|
|
16
|
+
"sync-platform-versions": "node scripts/sync-platform-versions.js",
|
|
17
|
+
"prepublishOnly": "npm run sync-platform-versions && npm run build:docker"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"bytenode": "^1.5.0",
|
|
21
|
+
"http-proxy": "^1.18.1"
|
|
22
|
+
},
|
|
23
|
+
"optionalDependencies": {
|
|
24
|
+
"webclaw-dashboard-server-linux-arm64": "1.4.2",
|
|
25
|
+
"webclaw-dashboard-server-linux-x64": "1.4.2"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": "22.x"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"bin/",
|
|
33
|
+
"dist/",
|
|
34
|
+
"lib/"
|
|
35
|
+
],
|
|
36
|
+
"license": "MIT"
|
|
37
|
+
}
|