Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
2.7 kB ยท 83 lines
JavaScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384#!/usr/bin/env node// kidlisp-dev.mjs - Watch console logs from kidlisp.com in Simple Browser
import { Web } from './web.mjs';
const web = new Web({ verbose: true });
async function main() { console.log('๐ Looking for kidlisp.com tab...'); try { await web.connect('kidlisp.com'); console.log('โ
Connected to kidlisp.com\n'); // Enable console logging await web.send('Runtime.enable'); await web.send('Console.enable'); await web.send('Log.enable'); // Listen for console messages web.ws.on('message', data => { try { const msg = JSON.parse(data); // Runtime.consoleAPICalled - main console.log etc if (msg.method === 'Runtime.consoleAPICalled') { const { type, args } = msg.params; const values = args.map(a => { if (a.type === 'string') return a.value; if (a.type === 'number') return a.value; if (a.type === 'boolean') return a.value; if (a.type === 'undefined') return 'undefined'; if (a.type === 'object' && a.preview) { return JSON.stringify(a.preview.properties?.reduce((o, p) => { o[p.name] = p.value; return o; }, {}) || a.preview); } return a.description || a.type; }); const icon = { log: '๐', warn: 'โ ๏ธ', error: 'โ', info: 'โน๏ธ', debug: '๐', }[type] || '๐'; console.log(`${icon} [${type}]`, values.join(' ')); } // Runtime.exceptionThrown - uncaught exceptions if (msg.method === 'Runtime.exceptionThrown') { const { exceptionDetails } = msg.params; console.log('๐ฅ [exception]', exceptionDetails.text || exceptionDetails.exception?.description); } // Log.entryAdded - browser/network logs if (msg.method === 'Log.entryAdded') { const { entry } = msg.params; console.log(`๐ [${entry.level}]`, entry.text, entry.url || ''); } } catch (e) { /* ignore parse errors */ } }); console.log('๐ก Watching console output... (Ctrl+C to stop)\n'); console.log('โ'.repeat(60) + '\n'); // Keep alive await new Promise(() => {}); } catch (e) { console.error('โ Error:', e.message); console.log('\n๐ก Make sure:'); console.log(' 1. CDP tunnel is running: ac-cdp-tunnel'); console.log(' 2. kidlisp.com is open in VS Code Simple Browser'); process.exit(1); }}
main();