@dainprotocol/tunnel 1.1.35 → 2.0.0
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/dist/client/index.d.ts +1 -6
- package/dist/client/index.js +120 -184
- package/dist/server/index.d.ts +6 -5
- package/dist/server/index.js +437 -372
- package/dist/server/start.js +4 -13
- package/package.json +8 -24
package/dist/server/start.js
CHANGED
|
@@ -1,24 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const index_1 = __importDefault(require("./index"));
|
|
7
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
8
|
-
// Load environment variables from .env file
|
|
9
|
-
dotenv_1.default.config();
|
|
1
|
+
import DainTunnelServer from './index';
|
|
2
|
+
// Bun auto-loads .env — no dotenv needed
|
|
10
3
|
// Handle uncaught exceptions to prevent server crashes
|
|
11
4
|
process.on('uncaughtException', (error) => {
|
|
12
5
|
console.error('[Fatal] Uncaught exception:', error);
|
|
13
|
-
// Don't exit - try to keep serving
|
|
14
6
|
});
|
|
15
7
|
process.on('unhandledRejection', (reason, promise) => {
|
|
16
8
|
console.error('[Fatal] Unhandled rejection at:', promise, 'reason:', reason);
|
|
17
|
-
// Don't exit - try to keep serving
|
|
18
9
|
});
|
|
19
10
|
const port = parseInt(process.env.PORT || '3000', 10);
|
|
20
11
|
const hostname = process.env.HOSTNAME || 'localhost';
|
|
21
|
-
const server = new
|
|
12
|
+
const server = new DainTunnelServer(hostname, port);
|
|
22
13
|
server.start()
|
|
23
14
|
.then(() => {
|
|
24
15
|
console.log(`DainTunnel Server started on http://${hostname}:${port}`);
|
|
@@ -28,7 +19,7 @@ server.start()
|
|
|
28
19
|
console.error('Failed to start DainTunnel Server:', error);
|
|
29
20
|
process.exit(1);
|
|
30
21
|
});
|
|
31
|
-
// Graceful shutdown
|
|
22
|
+
// Graceful shutdown
|
|
32
23
|
process.on('SIGTERM', () => {
|
|
33
24
|
console.log('[Server] SIGTERM received, shutting down gracefully...');
|
|
34
25
|
server.stop().then(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dainprotocol/tunnel",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -10,39 +10,23 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc",
|
|
12
12
|
"build:types": "tsc --emitDeclarationOnly",
|
|
13
|
-
"test": "
|
|
14
|
-
"test:watch": "jest --watch",
|
|
13
|
+
"test": "bun test",
|
|
15
14
|
"prepublishOnly": "npm run build && npm run build:types",
|
|
16
|
-
"start": "
|
|
17
|
-
"start-server": "
|
|
15
|
+
"start": "bun dist/server/start.js",
|
|
16
|
+
"start-server": "bun src/server/start.ts"
|
|
18
17
|
},
|
|
19
18
|
"keywords": [],
|
|
20
19
|
"author": "Ryan",
|
|
21
20
|
"license": "ISC",
|
|
22
21
|
"dependencies": {
|
|
23
|
-
"@dainprotocol/service-sdk": "2.0.
|
|
24
|
-
"@types/body-parser": "^1.19.5",
|
|
25
|
-
"@types/cors": "^2.8.17",
|
|
26
|
-
"@types/eventsource": "^3.0.0",
|
|
27
|
-
"@types/express": "^4.17.21",
|
|
22
|
+
"@dainprotocol/service-sdk": "2.0.88",
|
|
28
23
|
"@types/node": "^22.5.4",
|
|
29
|
-
"@types/uuid": "^10.0.0",
|
|
30
24
|
"@types/ws": "^8.5.12",
|
|
31
|
-
"
|
|
32
|
-
"cors": "^2.8.5",
|
|
33
|
-
"dotenv": "^16.4.5",
|
|
34
|
-
"eventsource": "^3.0.6",
|
|
35
|
-
"express": "^4.19.2",
|
|
36
|
-
"fetch-mock": "^11.1.3",
|
|
37
|
-
"ts-node": "^10.9.2",
|
|
38
|
-
"uuid": "^10.0.0",
|
|
25
|
+
"hono": "^4.7.0",
|
|
39
26
|
"ws": "^8.18.0"
|
|
40
27
|
},
|
|
41
28
|
"devDependencies": {
|
|
42
|
-
"@types/
|
|
43
|
-
"@types/jest": "^29.5.12",
|
|
44
|
-
"jest": "^29.7.0",
|
|
45
|
-
"ts-jest": "^29.1.5",
|
|
29
|
+
"@types/bun": "^1.2.0",
|
|
46
30
|
"typescript": "^5.0.0"
|
|
47
31
|
},
|
|
48
32
|
"files": [
|
|
@@ -50,7 +34,7 @@
|
|
|
50
34
|
"README.md"
|
|
51
35
|
],
|
|
52
36
|
"engines": {
|
|
53
|
-
"
|
|
37
|
+
"bun": ">=1.1.0"
|
|
54
38
|
},
|
|
55
39
|
"exports": {
|
|
56
40
|
".": "./dist/index.js",
|