@react-grab/cursor 0.0.67 → 0.0.69

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/cli.cjs CHANGED
@@ -6,6 +6,112 @@ var url = require('url');
6
6
  var path = require('path');
7
7
 
8
8
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
9
+ var __create = Object.create;
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __getProtoOf = Object.getPrototypeOf;
14
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
15
+ var __commonJS = (cb, mod) => function __require() {
16
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
+ // If the importer is in node compatibility mode or this is not an ESM
28
+ // file that has been converted to a CommonJS file using a Babel-
29
+ // compatible transform (i.e. "__esModule" has not been set), then set
30
+ // "default" to the CommonJS "module.exports" for node compatibility.
31
+ __defProp(target, "default", { value: mod, enumerable: true }) ,
32
+ mod
33
+ ));
34
+
35
+ // ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
36
+ var require_picocolors = __commonJS({
37
+ "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
38
+ var p = process || {};
39
+ var argv = p.argv || [];
40
+ var env = p.env || {};
41
+ var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
42
+ var formatter = (open, close, replace = open) => (input) => {
43
+ let string = "" + input, index = string.indexOf(close, open.length);
44
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
45
+ };
46
+ var replaceClose = (string, close, replace, index) => {
47
+ let result = "", cursor = 0;
48
+ do {
49
+ result += string.substring(cursor, index) + replace;
50
+ cursor = index + close.length;
51
+ index = string.indexOf(close, cursor);
52
+ } while (~index);
53
+ return result + string.substring(cursor);
54
+ };
55
+ var createColors = (enabled = isColorSupported) => {
56
+ let f = enabled ? formatter : () => String;
57
+ return {
58
+ isColorSupported: enabled,
59
+ reset: f("\x1B[0m", "\x1B[0m"),
60
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
61
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
62
+ italic: f("\x1B[3m", "\x1B[23m"),
63
+ underline: f("\x1B[4m", "\x1B[24m"),
64
+ inverse: f("\x1B[7m", "\x1B[27m"),
65
+ hidden: f("\x1B[8m", "\x1B[28m"),
66
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
67
+ black: f("\x1B[30m", "\x1B[39m"),
68
+ red: f("\x1B[31m", "\x1B[39m"),
69
+ green: f("\x1B[32m", "\x1B[39m"),
70
+ yellow: f("\x1B[33m", "\x1B[39m"),
71
+ blue: f("\x1B[34m", "\x1B[39m"),
72
+ magenta: f("\x1B[35m", "\x1B[39m"),
73
+ cyan: f("\x1B[36m", "\x1B[39m"),
74
+ white: f("\x1B[37m", "\x1B[39m"),
75
+ gray: f("\x1B[90m", "\x1B[39m"),
76
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
77
+ bgRed: f("\x1B[41m", "\x1B[49m"),
78
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
79
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
80
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
81
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
82
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
83
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
84
+ blackBright: f("\x1B[90m", "\x1B[39m"),
85
+ redBright: f("\x1B[91m", "\x1B[39m"),
86
+ greenBright: f("\x1B[92m", "\x1B[39m"),
87
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
88
+ blueBright: f("\x1B[94m", "\x1B[39m"),
89
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
90
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
91
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
92
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
93
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
94
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
95
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
96
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
97
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
98
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
99
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
100
+ };
101
+ };
102
+ module.exports = createColors();
103
+ module.exports.createColors = createColors;
104
+ }
105
+ });
106
+
107
+ // src/cli.ts
108
+ var import_picocolors = __toESM(require_picocolors());
109
+
110
+ // src/constants.ts
111
+ var DEFAULT_PORT = 5567;
112
+
113
+ // src/cli.ts
114
+ var VERSION = "0.0.69";
9
115
  var __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)));
10
116
  var __dirname$1 = path.dirname(__filename$1);
11
117
  var serverPath = path.join(__dirname$1, "server.js");
@@ -13,4 +119,5 @@ child_process.spawn(process.execPath, [serverPath], {
13
119
  detached: true,
14
120
  stdio: "ignore"
15
121
  }).unref();
16
- console.log("[React Grab] Server starting on port 5567...");
122
+ console.log(`${import_picocolors.default.magenta("\u269B")} ${import_picocolors.default.bold("React Grab")} ${import_picocolors.default.gray(VERSION)} ${import_picocolors.default.dim("(Cursor)")}`);
123
+ console.log(`- Local: ${import_picocolors.default.cyan(`http://localhost:${DEFAULT_PORT}`)}`);
package/dist/cli.js CHANGED
@@ -3,6 +3,112 @@ import { spawn } from 'child_process';
3
3
  import { fileURLToPath } from 'url';
4
4
  import { dirname, join } from 'path';
5
5
 
6
+ var __create = Object.create;
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getProtoOf = Object.getPrototypeOf;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __commonJS = (cb, mod) => function __require() {
13
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ __defProp(target, "default", { value: mod, enumerable: true }) ,
29
+ mod
30
+ ));
31
+
32
+ // ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
33
+ var require_picocolors = __commonJS({
34
+ "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
35
+ var p = process || {};
36
+ var argv = p.argv || [];
37
+ var env = p.env || {};
38
+ var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
39
+ var formatter = (open, close, replace = open) => (input) => {
40
+ let string = "" + input, index = string.indexOf(close, open.length);
41
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
42
+ };
43
+ var replaceClose = (string, close, replace, index) => {
44
+ let result = "", cursor = 0;
45
+ do {
46
+ result += string.substring(cursor, index) + replace;
47
+ cursor = index + close.length;
48
+ index = string.indexOf(close, cursor);
49
+ } while (~index);
50
+ return result + string.substring(cursor);
51
+ };
52
+ var createColors = (enabled = isColorSupported) => {
53
+ let f = enabled ? formatter : () => String;
54
+ return {
55
+ isColorSupported: enabled,
56
+ reset: f("\x1B[0m", "\x1B[0m"),
57
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
58
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
59
+ italic: f("\x1B[3m", "\x1B[23m"),
60
+ underline: f("\x1B[4m", "\x1B[24m"),
61
+ inverse: f("\x1B[7m", "\x1B[27m"),
62
+ hidden: f("\x1B[8m", "\x1B[28m"),
63
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
64
+ black: f("\x1B[30m", "\x1B[39m"),
65
+ red: f("\x1B[31m", "\x1B[39m"),
66
+ green: f("\x1B[32m", "\x1B[39m"),
67
+ yellow: f("\x1B[33m", "\x1B[39m"),
68
+ blue: f("\x1B[34m", "\x1B[39m"),
69
+ magenta: f("\x1B[35m", "\x1B[39m"),
70
+ cyan: f("\x1B[36m", "\x1B[39m"),
71
+ white: f("\x1B[37m", "\x1B[39m"),
72
+ gray: f("\x1B[90m", "\x1B[39m"),
73
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
74
+ bgRed: f("\x1B[41m", "\x1B[49m"),
75
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
76
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
77
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
78
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
79
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
80
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
81
+ blackBright: f("\x1B[90m", "\x1B[39m"),
82
+ redBright: f("\x1B[91m", "\x1B[39m"),
83
+ greenBright: f("\x1B[92m", "\x1B[39m"),
84
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
85
+ blueBright: f("\x1B[94m", "\x1B[39m"),
86
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
87
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
88
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
89
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
90
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
91
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
92
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
93
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
94
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
95
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
96
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
97
+ };
98
+ };
99
+ module.exports = createColors();
100
+ module.exports.createColors = createColors;
101
+ }
102
+ });
103
+
104
+ // src/cli.ts
105
+ var import_picocolors = __toESM(require_picocolors());
106
+
107
+ // src/constants.ts
108
+ var DEFAULT_PORT = 5567;
109
+
110
+ // src/cli.ts
111
+ var VERSION = "0.0.69";
6
112
  var __filename = fileURLToPath(import.meta.url);
7
113
  var __dirname = dirname(__filename);
8
114
  var serverPath = join(__dirname, "server.js");
@@ -10,4 +116,5 @@ spawn(process.execPath, [serverPath], {
10
116
  detached: true,
11
117
  stdio: "ignore"
12
118
  }).unref();
13
- console.log("[React Grab] Server starting on port 5567...");
119
+ console.log(`${import_picocolors.default.magenta("\u269B")} ${import_picocolors.default.bold("React Grab")} ${import_picocolors.default.gray(VERSION)} ${import_picocolors.default.dim("(Cursor)")}`);
120
+ console.log(`- Local: ${import_picocolors.default.cyan(`http://localhost:${DEFAULT_PORT}`)}`);
package/dist/client.cjs CHANGED
@@ -28,7 +28,10 @@ async function* streamSSE(stream) {
28
28
  const { eventType, data } = parseSSEEvent(buffer.slice(0, boundary));
29
29
  buffer = buffer.slice(boundary + 2);
30
30
  if (eventType === "done") return;
31
- if (eventType === "error") throw new Error(data || "Agent error");
31
+ if (eventType === "error") {
32
+ console.error("[react-grab]", data || "Agent error");
33
+ return;
34
+ }
32
35
  if (data) yield data;
33
36
  }
34
37
  if (done) break;
@@ -1,4 +1,4 @@
1
- var ReactGrabCursor=(function(exports){'use strict';var l=`http://localhost:${5567}`,f="react-grab:agent-sessions",S=n=>{let t="",r="";for(let e of n.split(`
2
- `))e.startsWith("event:")?t=e.slice(6).trim():e.startsWith("data:")&&(r=e.slice(5).trim());return {eventType:t,data:r}};async function*y(n){let t=n.getReader(),r=new TextDecoder,e="";try{for(;;){let{done:o,value:i}=await t.read();i&&(e+=r.decode(i,{stream:!0}));let s;for(;(s=e.indexOf(`
1
+ var ReactGrabCursor=(function(exports){'use strict';var l=`http://localhost:${5567}`,f="react-grab:agent-sessions",S=r=>{let t="",n="";for(let e of r.split(`
2
+ `))e.startsWith("event:")?t=e.slice(6).trim():e.startsWith("data:")&&(n=e.slice(5).trim());return {eventType:t,data:n}};async function*y(r){let t=r.getReader(),n=new TextDecoder,e="";try{for(;;){let{done:o,value:i}=await t.read();i&&(e+=n.decode(i,{stream:!0}));let s;for(;(s=e.indexOf(`
3
3
 
4
- `))!==-1;){let{eventType:a,data:c}=S(e.slice(0,s));if(e=e.slice(s+2),a==="done")return;if(a==="error")throw new Error(c||"Agent error");c&&(yield c);}if(o)break}}finally{t.releaseLock();}}async function*p(n,t,r){let e=await fetch(`${n}/agent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:r});if(!e.ok)throw new Error(`Server error: ${e.status}`);if(!e.body)throw new Error("No response body");yield*y(e.body);}var E=(n={})=>{let{serverUrl:t=l,getOptions:r}=n,e=o=>({...r?.()??{},...o??{}});return {send:async function*(o,i){let s={...o,options:e(o.options)};yield*p(t,s,i);},resume:async function*(o,i,s){let a=s.getItem(f);if(!a)throw new Error("No sessions to resume");let g=JSON.parse(a)[o];if(!g)throw new Error(`Session ${o} not found`);let d=g.context,u={...d,options:e(d.options)};yield "Resuming...",yield*p(t,u,i);},supportsResume:true}},C=async()=>{if(typeof window>"u")return;let n=E(),t=window.__REACT_GRAB__;if(t){t.setAgent({provider:n,storage:sessionStorage});return}window.addEventListener("react-grab:init",r=>{r.detail.setAgent({provider:n,storage:sessionStorage});},{once:true});};C();exports.attachAgent=C;exports.createCursorAgentProvider=E;return exports;})({});
4
+ `))!==-1;){let{eventType:a,data:c}=S(e.slice(0,s));if(e=e.slice(s+2),a==="done")return;if(a==="error"){console.error("[react-grab]",c||"Agent error");return}c&&(yield c);}if(o)break}}finally{t.releaseLock();}}async function*p(r,t,n){let e=await fetch(`${r}/agent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n});if(!e.ok)throw new Error(`Server error: ${e.status}`);if(!e.body)throw new Error("No response body");yield*y(e.body);}var C=(r={})=>{let{serverUrl:t=l,getOptions:n}=r,e=o=>({...n?.()??{},...o??{}});return {send:async function*(o,i){let s={...o,options:e(o.options)};yield*p(t,s,i);},resume:async function*(o,i,s){let a=s.getItem(f);if(!a)throw new Error("No sessions to resume");let g=JSON.parse(a)[o];if(!g)throw new Error(`Session ${o} not found`);let d=g.context,u={...d,options:e(d.options)};yield "Resuming...",yield*p(t,u,i);},supportsResume:true}},E=async()=>{if(typeof window>"u")return;let r=C(),t=window.__REACT_GRAB__;if(t){t.setAgent({provider:r,storage:sessionStorage});return}window.addEventListener("react-grab:init",n=>{n.detail.setAgent({provider:r,storage:sessionStorage});},{once:true});};E();exports.attachAgent=E;exports.createCursorAgentProvider=C;return exports;})({});
package/dist/client.js CHANGED
@@ -26,7 +26,10 @@ async function* streamSSE(stream) {
26
26
  const { eventType, data } = parseSSEEvent(buffer.slice(0, boundary));
27
27
  buffer = buffer.slice(boundary + 2);
28
28
  if (eventType === "done") return;
29
- if (eventType === "error") throw new Error(data || "Agent error");
29
+ if (eventType === "error") {
30
+ console.error("[react-grab]", data || "Agent error");
31
+ return;
32
+ }
30
33
  if (data) yield data;
31
34
  }
32
35
  if (done) break;
package/dist/server.cjs CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  var child_process = require('child_process');
4
4
  var net = require('net');
5
+ var url = require('url');
5
6
  var http = require('http');
6
7
  var http2 = require('http2');
7
8
  var stream = require('stream');
@@ -13,7 +14,103 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
14
  var net__default = /*#__PURE__*/_interopDefault(net);
14
15
  var crypto__default = /*#__PURE__*/_interopDefault(crypto);
15
16
 
16
- // src/server.ts
17
+ var __create = Object.create;
18
+ var __defProp = Object.defineProperty;
19
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
20
+ var __getOwnPropNames = Object.getOwnPropertyNames;
21
+ var __getProtoOf = Object.getPrototypeOf;
22
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
23
+ var __commonJS = (cb, mod) => function __require() {
24
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
25
+ };
26
+ var __copyProps = (to, from, except, desc) => {
27
+ if (from && typeof from === "object" || typeof from === "function") {
28
+ for (let key of __getOwnPropNames(from))
29
+ if (!__hasOwnProp.call(to, key) && key !== except)
30
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
31
+ }
32
+ return to;
33
+ };
34
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
35
+ // If the importer is in node compatibility mode or this is not an ESM
36
+ // file that has been converted to a CommonJS file using a Babel-
37
+ // compatible transform (i.e. "__esModule" has not been set), then set
38
+ // "default" to the CommonJS "module.exports" for node compatibility.
39
+ __defProp(target, "default", { value: mod, enumerable: true }) ,
40
+ mod
41
+ ));
42
+
43
+ // ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
44
+ var require_picocolors = __commonJS({
45
+ "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
46
+ var p = process || {};
47
+ var argv = p.argv || [];
48
+ var env = p.env || {};
49
+ var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
50
+ var formatter = (open, close, replace = open) => (input) => {
51
+ let string = "" + input, index = string.indexOf(close, open.length);
52
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
53
+ };
54
+ var replaceClose = (string, close, replace, index) => {
55
+ let result = "", cursor = 0;
56
+ do {
57
+ result += string.substring(cursor, index) + replace;
58
+ cursor = index + close.length;
59
+ index = string.indexOf(close, cursor);
60
+ } while (~index);
61
+ return result + string.substring(cursor);
62
+ };
63
+ var createColors = (enabled = isColorSupported) => {
64
+ let f = enabled ? formatter : () => String;
65
+ return {
66
+ isColorSupported: enabled,
67
+ reset: f("\x1B[0m", "\x1B[0m"),
68
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
69
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
70
+ italic: f("\x1B[3m", "\x1B[23m"),
71
+ underline: f("\x1B[4m", "\x1B[24m"),
72
+ inverse: f("\x1B[7m", "\x1B[27m"),
73
+ hidden: f("\x1B[8m", "\x1B[28m"),
74
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
75
+ black: f("\x1B[30m", "\x1B[39m"),
76
+ red: f("\x1B[31m", "\x1B[39m"),
77
+ green: f("\x1B[32m", "\x1B[39m"),
78
+ yellow: f("\x1B[33m", "\x1B[39m"),
79
+ blue: f("\x1B[34m", "\x1B[39m"),
80
+ magenta: f("\x1B[35m", "\x1B[39m"),
81
+ cyan: f("\x1B[36m", "\x1B[39m"),
82
+ white: f("\x1B[37m", "\x1B[39m"),
83
+ gray: f("\x1B[90m", "\x1B[39m"),
84
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
85
+ bgRed: f("\x1B[41m", "\x1B[49m"),
86
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
87
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
88
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
89
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
90
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
91
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
92
+ blackBright: f("\x1B[90m", "\x1B[39m"),
93
+ redBright: f("\x1B[91m", "\x1B[39m"),
94
+ greenBright: f("\x1B[92m", "\x1B[39m"),
95
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
96
+ blueBright: f("\x1B[94m", "\x1B[39m"),
97
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
98
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
99
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
100
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
101
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
102
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
103
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
104
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
105
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
106
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
107
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
108
+ };
109
+ };
110
+ module.exports = createColors();
111
+ module.exports.createColors = createColors;
112
+ }
113
+ });
17
114
 
18
115
  // ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/compose.js
19
116
  var compose = (middleware, onError, onNotFound) => {
@@ -2262,10 +2359,14 @@ var serve = (options, listeningListener) => {
2262
2359
  return server;
2263
2360
  };
2264
2361
 
2362
+ // src/server.ts
2363
+ var import_picocolors = __toESM(require_picocolors());
2364
+
2265
2365
  // src/constants.ts
2266
2366
  var DEFAULT_PORT = 5567;
2267
2367
 
2268
2368
  // src/server.ts
2369
+ var VERSION = "0.0.69";
2269
2370
  var parseStreamLine = (line) => {
2270
2371
  const trimmed = line.trim();
2271
2372
  if (!trimmed) return null;
@@ -2393,7 +2494,6 @@ ${content}`;
2393
2494
  data: `Error: ${errorMessage}`,
2394
2495
  event: "error"
2395
2496
  });
2396
- await stream2.writeSSE({ data: "", event: "done" });
2397
2497
  }
2398
2498
  });
2399
2499
  });
@@ -2417,9 +2517,10 @@ var startServer = async (port = DEFAULT_PORT) => {
2417
2517
  }
2418
2518
  const app = createServer();
2419
2519
  serve({ fetch: app.fetch, port });
2420
- console.log(`[React Grab] Server started on port ${port}`);
2520
+ console.log(`${import_picocolors.default.magenta("\u269B")} ${import_picocolors.default.bold("React Grab")} ${import_picocolors.default.gray(VERSION)} ${import_picocolors.default.dim("(Cursor)")}`);
2521
+ console.log(`- Local: ${import_picocolors.default.cyan(`http://localhost:${port}`)}`);
2421
2522
  };
2422
- if ((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('server.cjs', document.baseURI).href)) === `file://${process.argv[1]}`) {
2523
+ if ((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('server.cjs', document.baseURI).href)) === url.pathToFileURL(process.argv[1]).href) {
2423
2524
  startServer(DEFAULT_PORT).catch(console.error);
2424
2525
  }
2425
2526
 
package/dist/server.js CHANGED
@@ -1,11 +1,108 @@
1
1
  import { spawn } from 'child_process';
2
2
  import net from 'net';
3
+ import { pathToFileURL } from 'url';
3
4
  import { createServer as createServer$1 } from 'http';
4
5
  import { Http2ServerRequest } from 'http2';
5
6
  import { Readable } from 'stream';
6
7
  import crypto from 'crypto';
7
8
 
8
- // src/server.ts
9
+ var __create = Object.create;
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __getProtoOf = Object.getPrototypeOf;
14
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
15
+ var __commonJS = (cb, mod) => function __require() {
16
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
+ // If the importer is in node compatibility mode or this is not an ESM
28
+ // file that has been converted to a CommonJS file using a Babel-
29
+ // compatible transform (i.e. "__esModule" has not been set), then set
30
+ // "default" to the CommonJS "module.exports" for node compatibility.
31
+ __defProp(target, "default", { value: mod, enumerable: true }) ,
32
+ mod
33
+ ));
34
+
35
+ // ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
36
+ var require_picocolors = __commonJS({
37
+ "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
38
+ var p = process || {};
39
+ var argv = p.argv || [];
40
+ var env = p.env || {};
41
+ var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
42
+ var formatter = (open, close, replace = open) => (input) => {
43
+ let string = "" + input, index = string.indexOf(close, open.length);
44
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
45
+ };
46
+ var replaceClose = (string, close, replace, index) => {
47
+ let result = "", cursor = 0;
48
+ do {
49
+ result += string.substring(cursor, index) + replace;
50
+ cursor = index + close.length;
51
+ index = string.indexOf(close, cursor);
52
+ } while (~index);
53
+ return result + string.substring(cursor);
54
+ };
55
+ var createColors = (enabled = isColorSupported) => {
56
+ let f = enabled ? formatter : () => String;
57
+ return {
58
+ isColorSupported: enabled,
59
+ reset: f("\x1B[0m", "\x1B[0m"),
60
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
61
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
62
+ italic: f("\x1B[3m", "\x1B[23m"),
63
+ underline: f("\x1B[4m", "\x1B[24m"),
64
+ inverse: f("\x1B[7m", "\x1B[27m"),
65
+ hidden: f("\x1B[8m", "\x1B[28m"),
66
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
67
+ black: f("\x1B[30m", "\x1B[39m"),
68
+ red: f("\x1B[31m", "\x1B[39m"),
69
+ green: f("\x1B[32m", "\x1B[39m"),
70
+ yellow: f("\x1B[33m", "\x1B[39m"),
71
+ blue: f("\x1B[34m", "\x1B[39m"),
72
+ magenta: f("\x1B[35m", "\x1B[39m"),
73
+ cyan: f("\x1B[36m", "\x1B[39m"),
74
+ white: f("\x1B[37m", "\x1B[39m"),
75
+ gray: f("\x1B[90m", "\x1B[39m"),
76
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
77
+ bgRed: f("\x1B[41m", "\x1B[49m"),
78
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
79
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
80
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
81
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
82
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
83
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
84
+ blackBright: f("\x1B[90m", "\x1B[39m"),
85
+ redBright: f("\x1B[91m", "\x1B[39m"),
86
+ greenBright: f("\x1B[92m", "\x1B[39m"),
87
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
88
+ blueBright: f("\x1B[94m", "\x1B[39m"),
89
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
90
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
91
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
92
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
93
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
94
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
95
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
96
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
97
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
98
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
99
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
100
+ };
101
+ };
102
+ module.exports = createColors();
103
+ module.exports.createColors = createColors;
104
+ }
105
+ });
9
106
 
10
107
  // ../../node_modules/.pnpm/hono@4.10.7/node_modules/hono/dist/compose.js
11
108
  var compose = (middleware, onError, onNotFound) => {
@@ -2254,10 +2351,14 @@ var serve = (options, listeningListener) => {
2254
2351
  return server;
2255
2352
  };
2256
2353
 
2354
+ // src/server.ts
2355
+ var import_picocolors = __toESM(require_picocolors());
2356
+
2257
2357
  // src/constants.ts
2258
2358
  var DEFAULT_PORT = 5567;
2259
2359
 
2260
2360
  // src/server.ts
2361
+ var VERSION = "0.0.69";
2261
2362
  var parseStreamLine = (line) => {
2262
2363
  const trimmed = line.trim();
2263
2364
  if (!trimmed) return null;
@@ -2385,7 +2486,6 @@ ${content}`;
2385
2486
  data: `Error: ${errorMessage}`,
2386
2487
  event: "error"
2387
2488
  });
2388
- await stream2.writeSSE({ data: "", event: "done" });
2389
2489
  }
2390
2490
  });
2391
2491
  });
@@ -2409,9 +2509,10 @@ var startServer = async (port = DEFAULT_PORT) => {
2409
2509
  }
2410
2510
  const app = createServer();
2411
2511
  serve({ fetch: app.fetch, port });
2412
- console.log(`[React Grab] Server started on port ${port}`);
2512
+ console.log(`${import_picocolors.default.magenta("\u269B")} ${import_picocolors.default.bold("React Grab")} ${import_picocolors.default.gray(VERSION)} ${import_picocolors.default.dim("(Cursor)")}`);
2513
+ console.log(`- Local: ${import_picocolors.default.cyan(`http://localhost:${port}`)}`);
2413
2514
  };
2414
- if (import.meta.url === `file://${process.argv[1]}`) {
2515
+ if (import.meta.url === pathToFileURL(process.argv[1]).href) {
2415
2516
  startServer(DEFAULT_PORT).catch(console.error);
2416
2517
  }
2417
2518
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-grab/cursor",
3
- "version": "0.0.67",
3
+ "version": "0.0.69",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "react-grab-cursor": "./dist/cli.js"
@@ -29,7 +29,8 @@
29
29
  "dependencies": {
30
30
  "@hono/node-server": "^1.19.6",
31
31
  "hono": "^4.0.0",
32
- "react-grab": "0.0.67"
32
+ "picocolors": "^1.1.1",
33
+ "react-grab": "0.0.69"
33
34
  },
34
35
  "scripts": {
35
36
  "dev": "tsup --watch",