/** * Pear desktop entrypoint. * Boots pear-electron UI + pear-bridge HTTP for the HTML app shell. * * Under Bare: load bare-node-runtime globals so shared/client code can use * process/Buffer while package.json `imports` maps builtins → bare-*. * * @typedef {import('pear-interface')} */ /* global Pear */ if (typeof globalThis.Bare !== 'undefined') { await import('bare-node-runtime/global') } import Runtime from 'pear-electron' import Bridge from 'pear-bridge' const bridge = new Bridge() await bridge.ready() const runtime = new Runtime() const pipe = await runtime.start({ bridge }) const shutdown = async () => { try { Pear.exit() } catch { // ignore } } pipe.on('close', () => { shutdown() }) try { Pear.teardown?.(async () => {}) } catch { // ignore }