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-bare-target-matrix
**Protocol:** `bare-target-matrix/v1`
Cross-platform build target matrix. See [`docs/api.md`](docs/api.md).
```bash
npm install && npm test
```
@@ -0,0 +1,5 @@
# API: hyper-bare-target-matrix
**Protocol:** `bare-target-matrix/v1` · **Export:** `{ HyperBareTargetMatrix, PROTOCOL }`
See [`index.js`](../index.js) for methods and `getStats()`.
@@ -0,0 +1,3 @@
# Architecture: hyper-bare-target-matrix
Pear/Bare platform module. Replaces or complements deprecated `pear run` flows via embeddable `pear-runtime`.
@@ -0,0 +1,9 @@
require('bare-process/global')
const { HyperBareTargetMatrix } = require('../index.js')
async function main () {
const m = new HyperBareTargetMatrix()
await m.ready()
console.log(m.getStats())
await m.close()
}
main().catch((e) => { console.error(e); process.exit(1) })
@@ -0,0 +1,54 @@
require('bare-process/global')
const EventEmitter = require('bare-events')
const { platformStats } = require('../../_shared/pear-platform-base.js')
const PROTOCOL = 'bare-target-matrix/v1'
const DEFAULT_TARGETS = [
{ id: 'darwin-arm64', os: 'darwin', arch: 'arm64' },
{ id: 'darwin-x64', os: 'darwin', arch: 'x64' },
{ id: 'linux-arm64', os: 'linux', arch: 'arm64' },
{ id: 'linux-x64', os: 'linux', arch: 'x64' },
{ id: 'android-arm64', os: 'android', arch: 'arm64' },
{ id: 'ios-arm64', os: 'ios', arch: 'arm64' }
]
class HyperBareTargetMatrix extends EventEmitter {
constructor (opts = {}) {
super()
this._targets = [...(opts.targets || DEFAULT_TARGETS)]
this.host = opts.host || 'darwin-arm64'
this._stats = { selects: 0 }
}
list () { return [...this._targets] }
select (id) {
const t = this._targets.find((x) => x.id === id)
if (!t) throw new Error(`unknown target: ${id}`)
this.host = t.id
this._stats.selects++
this.emit('select', t)
return t
}
current () {
return this._targets.find((x) => x.id === this.host) || null
}
artifactName (binary = 'pear-runtime') {
const t = this.current()
if (!t) return binary
const ext = t.os === 'darwin' || t.os === 'linux' ? '' : '.exe'
return `${binary}-${t.id}${ext}`
}
getStats () {
return platformStats(this._stats, PROTOCOL, { host: this.host, count: this._targets.length })
}
async ready () { return this }
async close () { this.emit('closed') }
}
module.exports = { HyperBareTargetMatrix, HyperP2PBareTargetMatrix: HyperBareTargetMatrix, PROTOCOL }
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,21 @@
{
"name": "hyper-bare-target-matrix",
"version": "0.0.0-scaffold",
"description": "Cross-platform build target matrix.",
"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 { HyperBareTargetMatrix } = require('../index.js')
test('select target', async (t) => {
const m = new HyperBareTargetMatrix()
m.select('linux-arm64')
t.ok(m.artifactName().includes('linux-arm64'))
await m.close()
})