@react-grab/codex 0.0.81 → 0.0.83

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
@@ -1,18 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var url = require('url');
5
4
  var path = require('path');
6
- var child_process = require('child_process');
7
5
 
8
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
9
6
  var __create = Object.create;
10
7
  var __defProp = Object.defineProperty;
11
8
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
9
  var __getOwnPropNames = Object.getOwnPropertyNames;
13
10
  var __getProtoOf = Object.getPrototypeOf;
14
11
  var __hasOwnProp = Object.prototype.hasOwnProperty;
15
- var __commonJS = (cb, mod) => function __require() {
12
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
13
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
14
+ }) : x)(function(x) {
15
+ if (typeof require !== "undefined") return require.apply(this, arguments);
16
+ throw Error('Dynamic require of "' + x + '" is not supported');
17
+ });
18
+ var __commonJS = (cb, mod) => function __require2() {
16
19
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
20
  };
18
21
  var __copyProps = (to, from, except, desc) => {
@@ -32,6 +35,494 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
35
  mod
33
36
  ));
34
37
 
38
+ // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
39
+ var require_windows = __commonJS({
40
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module) {
41
+ module.exports = isexe;
42
+ isexe.sync = sync;
43
+ var fs = __require("fs");
44
+ function checkPathExt(path, options) {
45
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
46
+ if (!pathext) {
47
+ return true;
48
+ }
49
+ pathext = pathext.split(";");
50
+ if (pathext.indexOf("") !== -1) {
51
+ return true;
52
+ }
53
+ for (var i = 0; i < pathext.length; i++) {
54
+ var p = pathext[i].toLowerCase();
55
+ if (p && path.substr(-p.length).toLowerCase() === p) {
56
+ return true;
57
+ }
58
+ }
59
+ return false;
60
+ }
61
+ function checkStat(stat, path, options) {
62
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
63
+ return false;
64
+ }
65
+ return checkPathExt(path, options);
66
+ }
67
+ function isexe(path, options, cb) {
68
+ fs.stat(path, function(er, stat) {
69
+ cb(er, er ? false : checkStat(stat, path, options));
70
+ });
71
+ }
72
+ function sync(path, options) {
73
+ return checkStat(fs.statSync(path), path, options);
74
+ }
75
+ }
76
+ });
77
+
78
+ // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
79
+ var require_mode = __commonJS({
80
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module) {
81
+ module.exports = isexe;
82
+ isexe.sync = sync;
83
+ var fs = __require("fs");
84
+ function isexe(path, options, cb) {
85
+ fs.stat(path, function(er, stat) {
86
+ cb(er, er ? false : checkStat(stat, options));
87
+ });
88
+ }
89
+ function sync(path, options) {
90
+ return checkStat(fs.statSync(path), options);
91
+ }
92
+ function checkStat(stat, options) {
93
+ return stat.isFile() && checkMode(stat, options);
94
+ }
95
+ function checkMode(stat, options) {
96
+ var mod = stat.mode;
97
+ var uid = stat.uid;
98
+ var gid = stat.gid;
99
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
100
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
101
+ var u = parseInt("100", 8);
102
+ var g = parseInt("010", 8);
103
+ var o = parseInt("001", 8);
104
+ var ug = u | g;
105
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
106
+ return ret;
107
+ }
108
+ }
109
+ });
110
+
111
+ // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
112
+ var require_isexe = __commonJS({
113
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module) {
114
+ __require("fs");
115
+ var core;
116
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
117
+ core = require_windows();
118
+ } else {
119
+ core = require_mode();
120
+ }
121
+ module.exports = isexe;
122
+ isexe.sync = sync;
123
+ function isexe(path, options, cb) {
124
+ if (typeof options === "function") {
125
+ cb = options;
126
+ options = {};
127
+ }
128
+ if (!cb) {
129
+ if (typeof Promise !== "function") {
130
+ throw new TypeError("callback not provided");
131
+ }
132
+ return new Promise(function(resolve, reject) {
133
+ isexe(path, options || {}, function(er, is) {
134
+ if (er) {
135
+ reject(er);
136
+ } else {
137
+ resolve(is);
138
+ }
139
+ });
140
+ });
141
+ }
142
+ core(path, options || {}, function(er, is) {
143
+ if (er) {
144
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
145
+ er = null;
146
+ is = false;
147
+ }
148
+ }
149
+ cb(er, is);
150
+ });
151
+ }
152
+ function sync(path, options) {
153
+ try {
154
+ return core.sync(path, options || {});
155
+ } catch (er) {
156
+ if (options && options.ignoreErrors || er.code === "EACCES") {
157
+ return false;
158
+ } else {
159
+ throw er;
160
+ }
161
+ }
162
+ }
163
+ }
164
+ });
165
+
166
+ // ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
167
+ var require_which = __commonJS({
168
+ "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
169
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
170
+ var path = __require("path");
171
+ var COLON = isWindows ? ";" : ":";
172
+ var isexe = require_isexe();
173
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
174
+ var getPathInfo = (cmd, opt) => {
175
+ const colon = opt.colon || COLON;
176
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
177
+ // windows always checks the cwd first
178
+ ...isWindows ? [process.cwd()] : [],
179
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
180
+ "").split(colon)
181
+ ];
182
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
183
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
184
+ if (isWindows) {
185
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
186
+ pathExt.unshift("");
187
+ }
188
+ return {
189
+ pathEnv,
190
+ pathExt,
191
+ pathExtExe
192
+ };
193
+ };
194
+ var which = (cmd, opt, cb) => {
195
+ if (typeof opt === "function") {
196
+ cb = opt;
197
+ opt = {};
198
+ }
199
+ if (!opt)
200
+ opt = {};
201
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
202
+ const found = [];
203
+ const step = (i) => new Promise((resolve, reject) => {
204
+ if (i === pathEnv.length)
205
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
206
+ const ppRaw = pathEnv[i];
207
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
208
+ const pCmd = path.join(pathPart, cmd);
209
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
210
+ resolve(subStep(p, i, 0));
211
+ });
212
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
213
+ if (ii === pathExt.length)
214
+ return resolve(step(i + 1));
215
+ const ext = pathExt[ii];
216
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
217
+ if (!er && is) {
218
+ if (opt.all)
219
+ found.push(p + ext);
220
+ else
221
+ return resolve(p + ext);
222
+ }
223
+ return resolve(subStep(p, i, ii + 1));
224
+ });
225
+ });
226
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
227
+ };
228
+ var whichSync = (cmd, opt) => {
229
+ opt = opt || {};
230
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
231
+ const found = [];
232
+ for (let i = 0; i < pathEnv.length; i++) {
233
+ const ppRaw = pathEnv[i];
234
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
235
+ const pCmd = path.join(pathPart, cmd);
236
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
237
+ for (let j = 0; j < pathExt.length; j++) {
238
+ const cur = p + pathExt[j];
239
+ try {
240
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
241
+ if (is) {
242
+ if (opt.all)
243
+ found.push(cur);
244
+ else
245
+ return cur;
246
+ }
247
+ } catch (ex) {
248
+ }
249
+ }
250
+ }
251
+ if (opt.all && found.length)
252
+ return found;
253
+ if (opt.nothrow)
254
+ return null;
255
+ throw getNotFoundError(cmd);
256
+ };
257
+ module.exports = which;
258
+ which.sync = whichSync;
259
+ }
260
+ });
261
+
262
+ // ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
263
+ var require_path_key = __commonJS({
264
+ "../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module) {
265
+ var pathKey = (options = {}) => {
266
+ const environment = options.env || process.env;
267
+ const platform = options.platform || process.platform;
268
+ if (platform !== "win32") {
269
+ return "PATH";
270
+ }
271
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
272
+ };
273
+ module.exports = pathKey;
274
+ module.exports.default = pathKey;
275
+ }
276
+ });
277
+
278
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
279
+ var require_resolveCommand = __commonJS({
280
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
281
+ var path = __require("path");
282
+ var which = require_which();
283
+ var getPathKey = require_path_key();
284
+ function resolveCommandAttempt(parsed, withoutPathExt) {
285
+ const env = parsed.options.env || process.env;
286
+ const cwd = process.cwd();
287
+ const hasCustomCwd = parsed.options.cwd != null;
288
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
289
+ if (shouldSwitchCwd) {
290
+ try {
291
+ process.chdir(parsed.options.cwd);
292
+ } catch (err) {
293
+ }
294
+ }
295
+ let resolved;
296
+ try {
297
+ resolved = which.sync(parsed.command, {
298
+ path: env[getPathKey({ env })],
299
+ pathExt: withoutPathExt ? path.delimiter : void 0
300
+ });
301
+ } catch (e) {
302
+ } finally {
303
+ if (shouldSwitchCwd) {
304
+ process.chdir(cwd);
305
+ }
306
+ }
307
+ if (resolved) {
308
+ resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
309
+ }
310
+ return resolved;
311
+ }
312
+ function resolveCommand(parsed) {
313
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
314
+ }
315
+ module.exports = resolveCommand;
316
+ }
317
+ });
318
+
319
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
320
+ var require_escape = __commonJS({
321
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports, module) {
322
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
323
+ function escapeCommand(arg) {
324
+ arg = arg.replace(metaCharsRegExp, "^$1");
325
+ return arg;
326
+ }
327
+ function escapeArgument(arg, doubleEscapeMetaChars) {
328
+ arg = `${arg}`;
329
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
330
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
331
+ arg = `"${arg}"`;
332
+ arg = arg.replace(metaCharsRegExp, "^$1");
333
+ if (doubleEscapeMetaChars) {
334
+ arg = arg.replace(metaCharsRegExp, "^$1");
335
+ }
336
+ return arg;
337
+ }
338
+ module.exports.command = escapeCommand;
339
+ module.exports.argument = escapeArgument;
340
+ }
341
+ });
342
+
343
+ // ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
344
+ var require_shebang_regex = __commonJS({
345
+ "../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module) {
346
+ module.exports = /^#!(.*)/;
347
+ }
348
+ });
349
+
350
+ // ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
351
+ var require_shebang_command = __commonJS({
352
+ "../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module) {
353
+ var shebangRegex = require_shebang_regex();
354
+ module.exports = (string = "") => {
355
+ const match = string.match(shebangRegex);
356
+ if (!match) {
357
+ return null;
358
+ }
359
+ const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
360
+ const binary = path.split("/").pop();
361
+ if (binary === "env") {
362
+ return argument;
363
+ }
364
+ return argument ? `${binary} ${argument}` : binary;
365
+ };
366
+ }
367
+ });
368
+
369
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
370
+ var require_readShebang = __commonJS({
371
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
372
+ var fs = __require("fs");
373
+ var shebangCommand = require_shebang_command();
374
+ function readShebang(command) {
375
+ const size = 150;
376
+ const buffer = Buffer.alloc(size);
377
+ let fd;
378
+ try {
379
+ fd = fs.openSync(command, "r");
380
+ fs.readSync(fd, buffer, 0, size, 0);
381
+ fs.closeSync(fd);
382
+ } catch (e) {
383
+ }
384
+ return shebangCommand(buffer.toString());
385
+ }
386
+ module.exports = readShebang;
387
+ }
388
+ });
389
+
390
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
391
+ var require_parse = __commonJS({
392
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
393
+ var path = __require("path");
394
+ var resolveCommand = require_resolveCommand();
395
+ var escape = require_escape();
396
+ var readShebang = require_readShebang();
397
+ var isWin = process.platform === "win32";
398
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
399
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
400
+ function detectShebang(parsed) {
401
+ parsed.file = resolveCommand(parsed);
402
+ const shebang = parsed.file && readShebang(parsed.file);
403
+ if (shebang) {
404
+ parsed.args.unshift(parsed.file);
405
+ parsed.command = shebang;
406
+ return resolveCommand(parsed);
407
+ }
408
+ return parsed.file;
409
+ }
410
+ function parseNonShell(parsed) {
411
+ if (!isWin) {
412
+ return parsed;
413
+ }
414
+ const commandFile = detectShebang(parsed);
415
+ const needsShell = !isExecutableRegExp.test(commandFile);
416
+ if (parsed.options.forceShell || needsShell) {
417
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
418
+ parsed.command = path.normalize(parsed.command);
419
+ parsed.command = escape.command(parsed.command);
420
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
421
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
422
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
423
+ parsed.command = process.env.comspec || "cmd.exe";
424
+ parsed.options.windowsVerbatimArguments = true;
425
+ }
426
+ return parsed;
427
+ }
428
+ function parse(command, args, options) {
429
+ if (args && !Array.isArray(args)) {
430
+ options = args;
431
+ args = null;
432
+ }
433
+ args = args ? args.slice(0) : [];
434
+ options = Object.assign({}, options);
435
+ const parsed = {
436
+ command,
437
+ args,
438
+ options,
439
+ file: void 0,
440
+ original: {
441
+ command,
442
+ args
443
+ }
444
+ };
445
+ return options.shell ? parsed : parseNonShell(parsed);
446
+ }
447
+ module.exports = parse;
448
+ }
449
+ });
450
+
451
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
452
+ var require_enoent = __commonJS({
453
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports, module) {
454
+ var isWin = process.platform === "win32";
455
+ function notFoundError(original, syscall) {
456
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
457
+ code: "ENOENT",
458
+ errno: "ENOENT",
459
+ syscall: `${syscall} ${original.command}`,
460
+ path: original.command,
461
+ spawnargs: original.args
462
+ });
463
+ }
464
+ function hookChildProcess(cp, parsed) {
465
+ if (!isWin) {
466
+ return;
467
+ }
468
+ const originalEmit = cp.emit;
469
+ cp.emit = function(name, arg1) {
470
+ if (name === "exit") {
471
+ const err = verifyENOENT(arg1, parsed);
472
+ if (err) {
473
+ return originalEmit.call(cp, "error", err);
474
+ }
475
+ }
476
+ return originalEmit.apply(cp, arguments);
477
+ };
478
+ }
479
+ function verifyENOENT(status, parsed) {
480
+ if (isWin && status === 1 && !parsed.file) {
481
+ return notFoundError(parsed.original, "spawn");
482
+ }
483
+ return null;
484
+ }
485
+ function verifyENOENTSync(status, parsed) {
486
+ if (isWin && status === 1 && !parsed.file) {
487
+ return notFoundError(parsed.original, "spawnSync");
488
+ }
489
+ return null;
490
+ }
491
+ module.exports = {
492
+ hookChildProcess,
493
+ verifyENOENT,
494
+ verifyENOENTSync,
495
+ notFoundError
496
+ };
497
+ }
498
+ });
499
+
500
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
501
+ var require_cross_spawn = __commonJS({
502
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports, module) {
503
+ var cp = __require("child_process");
504
+ var parse = require_parse();
505
+ var enoent = require_enoent();
506
+ function spawn2(command, args, options) {
507
+ const parsed = parse(command, args, options);
508
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
509
+ enoent.hookChildProcess(spawned, parsed);
510
+ return spawned;
511
+ }
512
+ function spawnSync(command, args, options) {
513
+ const parsed = parse(command, args, options);
514
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
515
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
516
+ return result;
517
+ }
518
+ module.exports = spawn2;
519
+ module.exports.spawn = spawn2;
520
+ module.exports.sync = spawnSync;
521
+ module.exports._parse = parse;
522
+ module.exports._enoent = enoent;
523
+ }
524
+ });
525
+
35
526
  // ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
36
527
  var require_picocolors = __commonJS({
37
528
  "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
@@ -105,17 +596,16 @@ var require_picocolors = __commonJS({
105
596
  });
106
597
 
107
598
  // src/cli.ts
599
+ var import_cross_spawn = __toESM(require_cross_spawn());
108
600
  var import_picocolors = __toESM(require_picocolors());
109
601
 
110
602
  // src/constants.ts
111
603
  var DEFAULT_PORT = 7567;
112
604
 
113
605
  // src/cli.ts
114
- var VERSION = "0.0.81";
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)));
116
- var __dirname$1 = path.dirname(__filename$1);
117
- var serverPath = path.join(__dirname$1, "server.js");
118
- child_process.spawn(process.execPath, [serverPath], {
606
+ var VERSION = "0.0.83";
607
+ var serverPath = path.join(__dirname, "server.js");
608
+ (0, import_cross_spawn.default)(process.execPath, [serverPath], {
119
609
  detached: true,
120
610
  stdio: "ignore"
121
611
  }).unref();