@react-grab/cursor 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 CHANGED
@@ -2399,7 +2399,24 @@ ${content}`;
2399
2399
  });
2400
2400
  return app;
2401
2401
  };
2402
+ var killProcessOnPort = (port) => {
2403
+ try {
2404
+ if (process.platform === "win32") {
2405
+ child_process.execSync(
2406
+ `for /f "tokens=5" %a in ('netstat -aon ^| findstr :${port} ^| findstr LISTENING') do taskkill /F /PID %a`,
2407
+ { stdio: "ignore", timeout: 1e3, shell: "cmd.exe" }
2408
+ );
2409
+ } else {
2410
+ child_process.execSync(`lsof -ti:${port} | xargs kill -9 2>/dev/null`, {
2411
+ stdio: "ignore",
2412
+ timeout: 1e3
2413
+ });
2414
+ }
2415
+ } catch {
2416
+ }
2417
+ };
2402
2418
  var startServer = (port = DEFAULT_PORT) => {
2419
+ killProcessOnPort(port);
2403
2420
  const app = createServer();
2404
2421
  serve({ fetch: app.fetch, port });
2405
2422
  console.log("React Grab Cursor server running on port", port);
package/dist/server.js CHANGED
@@ -1,4 +1,4 @@
1
- import { spawn } from 'child_process';
1
+ import { execSync, spawn } from 'child_process';
2
2
  import { createServer as createServer$1 } from 'http';
3
3
  import { Http2ServerRequest } from 'http2';
4
4
  import { Readable } from 'stream';
@@ -2393,7 +2393,24 @@ ${content}`;
2393
2393
  });
2394
2394
  return app;
2395
2395
  };
2396
+ var killProcessOnPort = (port) => {
2397
+ try {
2398
+ if (process.platform === "win32") {
2399
+ execSync(
2400
+ `for /f "tokens=5" %a in ('netstat -aon ^| findstr :${port} ^| findstr LISTENING') do taskkill /F /PID %a`,
2401
+ { stdio: "ignore", timeout: 1e3, shell: "cmd.exe" }
2402
+ );
2403
+ } else {
2404
+ execSync(`lsof -ti:${port} | xargs kill -9 2>/dev/null`, {
2405
+ stdio: "ignore",
2406
+ timeout: 1e3
2407
+ });
2408
+ }
2409
+ } catch {
2410
+ }
2411
+ };
2396
2412
  var startServer = (port = DEFAULT_PORT) => {
2413
+ killProcessOnPort(port);
2397
2414
  const app = createServer();
2398
2415
  serve({ fetch: app.fetch, port });
2399
2416
  console.log("React Grab Cursor server running on port", port);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-grab/cursor",
3
- "version": "0.0.58",
3
+ "version": "0.0.59",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./client": {
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "@hono/node-server": "^1.19.6",
25
25
  "hono": "^4.0.0",
26
- "react-grab": "0.0.58"
26
+ "react-grab": "0.0.59"
27
27
  },
28
28
  "scripts": {
29
29
  "dev": "tsup --watch",