@react-grab/claude-code 0.0.58 → 0.0.59
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/server.cjs +20 -1
- package/dist/server.js +20 -1
- package/package.json +2 -2
package/dist/server.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var child_process = require('child_process');
|
|
3
4
|
var http = require('http');
|
|
4
5
|
var http2 = require('http2');
|
|
5
6
|
var stream = require('stream');
|
|
@@ -7,7 +8,6 @@ var crypto = require('crypto');
|
|
|
7
8
|
var path = require('path');
|
|
8
9
|
var url = require('url');
|
|
9
10
|
var events = require('events');
|
|
10
|
-
var child_process = require('child_process');
|
|
11
11
|
var readline = require('readline');
|
|
12
12
|
var fs = require('fs');
|
|
13
13
|
var promises = require('fs/promises');
|
|
@@ -38,6 +38,8 @@ function _interopNamespace(e) {
|
|
|
38
38
|
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
39
39
|
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
40
40
|
|
|
41
|
+
// src/server.ts
|
|
42
|
+
|
|
41
43
|
// ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/compose.js
|
|
42
44
|
var compose = (middleware, onError, onNotFound) => {
|
|
43
45
|
return (context, next) => {
|
|
@@ -14644,7 +14646,24 @@ ${content}`;
|
|
|
14644
14646
|
});
|
|
14645
14647
|
return app;
|
|
14646
14648
|
};
|
|
14649
|
+
var killProcessOnPort = (port) => {
|
|
14650
|
+
try {
|
|
14651
|
+
if (process.platform === "win32") {
|
|
14652
|
+
child_process.execSync(
|
|
14653
|
+
`for /f "tokens=5" %a in ('netstat -aon ^| findstr :${port} ^| findstr LISTENING') do taskkill /F /PID %a`,
|
|
14654
|
+
{ stdio: "ignore", timeout: 1e3, shell: "cmd.exe" }
|
|
14655
|
+
);
|
|
14656
|
+
} else {
|
|
14657
|
+
child_process.execSync(`lsof -ti:${port} | xargs kill -9 2>/dev/null`, {
|
|
14658
|
+
stdio: "ignore",
|
|
14659
|
+
timeout: 1e3
|
|
14660
|
+
});
|
|
14661
|
+
}
|
|
14662
|
+
} catch {
|
|
14663
|
+
}
|
|
14664
|
+
};
|
|
14647
14665
|
var startServer = (port = DEFAULT_PORT) => {
|
|
14666
|
+
killProcessOnPort(port);
|
|
14648
14667
|
const app = createServer();
|
|
14649
14668
|
serve({ fetch: app.fetch, port });
|
|
14650
14669
|
console.log("React Grab Claude Code server running on port", port);
|
package/dist/server.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { execSync, spawn } from 'child_process';
|
|
1
2
|
import { createServer as createServer$1 } from 'http';
|
|
2
3
|
import { Http2ServerRequest } from 'http2';
|
|
3
4
|
import { Readable } from 'stream';
|
|
@@ -5,7 +6,6 @@ import crypto, { randomUUID } from 'crypto';
|
|
|
5
6
|
import { dirname, join } from 'path';
|
|
6
7
|
import { fileURLToPath } from 'url';
|
|
7
8
|
import { setMaxListeners } from 'events';
|
|
8
|
-
import { spawn } from 'child_process';
|
|
9
9
|
import { createInterface } from 'readline';
|
|
10
10
|
import * as fs from 'fs';
|
|
11
11
|
import { realpathSync } from 'fs';
|
|
@@ -13,6 +13,8 @@ import { stat } from 'fs/promises';
|
|
|
13
13
|
import { homedir } from 'os';
|
|
14
14
|
import { cwd } from 'process';
|
|
15
15
|
|
|
16
|
+
// src/server.ts
|
|
17
|
+
|
|
16
18
|
// ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/compose.js
|
|
17
19
|
var compose = (middleware, onError, onNotFound) => {
|
|
18
20
|
return (context, next) => {
|
|
@@ -14619,7 +14621,24 @@ ${content}`;
|
|
|
14619
14621
|
});
|
|
14620
14622
|
return app;
|
|
14621
14623
|
};
|
|
14624
|
+
var killProcessOnPort = (port) => {
|
|
14625
|
+
try {
|
|
14626
|
+
if (process.platform === "win32") {
|
|
14627
|
+
execSync(
|
|
14628
|
+
`for /f "tokens=5" %a in ('netstat -aon ^| findstr :${port} ^| findstr LISTENING') do taskkill /F /PID %a`,
|
|
14629
|
+
{ stdio: "ignore", timeout: 1e3, shell: "cmd.exe" }
|
|
14630
|
+
);
|
|
14631
|
+
} else {
|
|
14632
|
+
execSync(`lsof -ti:${port} | xargs kill -9 2>/dev/null`, {
|
|
14633
|
+
stdio: "ignore",
|
|
14634
|
+
timeout: 1e3
|
|
14635
|
+
});
|
|
14636
|
+
}
|
|
14637
|
+
} catch {
|
|
14638
|
+
}
|
|
14639
|
+
};
|
|
14622
14640
|
var startServer = (port = DEFAULT_PORT) => {
|
|
14641
|
+
killProcessOnPort(port);
|
|
14623
14642
|
const app = createServer();
|
|
14624
14643
|
serve({ fetch: app.fetch, port });
|
|
14625
14644
|
console.log("React Grab Claude Code server running on port", port);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-grab/claude-code",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.59",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./client": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@anthropic-ai/claude-agent-sdk": "^0.1.0",
|
|
25
25
|
"@hono/node-server": "^1.19.6",
|
|
26
26
|
"hono": "^4.0.0",
|
|
27
|
-
"react-grab": "0.0.
|
|
27
|
+
"react-grab": "0.0.59"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"dev": "tsup --watch",
|