Add 20 Pear/Bare platform modules replacing deprecated pear run.

Introduces hyper-bare-entry-runner, pear-runtime embed/link/config stack,
and scaffold helpers for argv, storage, OTA, Electron, and headless UI.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-21 01:29:28 -04:00
co-authored by Cursor
parent ad3fc106f1
commit 64a2a824b5
187 changed files with 28587 additions and 21 deletions
@@ -0,0 +1,5 @@
# Changelog
## 0.0.0-scaffold
- Initial Pear platform module.
@@ -0,0 +1,9 @@
# hyper-pear-storage-layout
**Protocol:** `pear-storage-layout/v1`
App storage and corestore path layout. See [`docs/api.md`](docs/api.md).
```bash
npm install && npm test
```
@@ -0,0 +1,5 @@
# API: hyper-pear-storage-layout
**Protocol:** `pear-storage-layout/v1` · **Export:** `{ HyperPearStorageLayout, PROTOCOL }`
See [`index.js`](../index.js) for methods and `getStats()`.
@@ -0,0 +1,3 @@
# Architecture: hyper-pear-storage-layout
Pear/Bare platform module. Replaces or complements deprecated `pear run` flows via embeddable `pear-runtime`.
@@ -0,0 +1,9 @@
require('bare-process/global')
const { HyperPearStorageLayout } = require('../index.js')
async function main () {
const m = new HyperPearStorageLayout()
await m.ready()
console.log(m.getStats())
await m.close()
}
main().catch((e) => { console.error(e); process.exit(1) })
@@ -0,0 +1,48 @@
require('bare-process/global')
const EventEmitter = require('bare-events')
const { assertId, platformStats } = require('../../_shared/pear-platform-base.js')
const PROTOCOL = 'pear-storage-layout/v1'
class HyperPearStorageLayout extends EventEmitter {
constructor (opts = {}) {
super()
this.root = opts.root || '.'
this._apps = new Map()
this._stats = { registered: 0 }
}
registerApp (appKey, layout = {}) {
const key = assertId(appKey, 'appKey')
const entry = {
appKey: key,
storage: layout.storage || `${this.root}/storage/${key}`,
prefs: layout.prefs || `${this.root}/prefs/${key}`,
core: layout.core || `${this.root}/pear-runtime/corestore`,
at: Date.now()
}
this._apps.set(key, entry)
this._stats.registered++
this.emit('register', entry)
return entry
}
pathsFor (appKey) {
return this._apps.get(assertId(appKey, 'appKey')) || null
}
clearApp (appKey) {
return this._apps.delete(assertId(appKey, 'appKey'))
}
listApps () { return [...this._apps.keys()] }
getStats () {
return platformStats(this._stats, PROTOCOL, { apps: this._apps.size })
}
async ready () { return this }
async close () { this._apps.clear(); this.emit('closed') }
}
module.exports = { HyperPearStorageLayout, HyperP2PPearStorageLayout: HyperPearStorageLayout, PROTOCOL }
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,21 @@
{
"name": "hyper-pear-storage-layout",
"version": "0.0.0-scaffold",
"description": "App storage and corestore path layout.",
"main": "index.js",
"type": "commonjs",
"license": "Apache-2.0",
"scripts": { "test": "brittle-bare test/test.js" },
"dependencies": {
"bare-events": "^2.8.0",
"bare-process": "^4.4.0",
"b4a": "^1.6.7",
"hypercore-crypto": "^3.0.0"
},
"peerDependencies": { "bare": ">=1.0.0" },
"devDependencies": { "brittle": "^3.0.0" },
"imports": {
"process": { "bare": "bare-process", "default": "process" },
"events": { "bare": "bare-events", "default": "events" }
}
}
@@ -0,0 +1,10 @@
require('bare-process/global')
const test = require('brittle')
const { HyperPearStorageLayout } = require('../index.js')
test('paths', async (t) => {
const s = new HyperPearStorageLayout({ root: '/r' })
const p = s.registerApp('app1')
t.ok(p.storage.includes('app1'))
await s.close()
})