OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-svc commits / 7e25db3

bare-migration: hyper-svc imports + bare-net createConnection
Migration cascade for pgh-bare. hyper-svc is pgh's transport layer; needed the same #node:* import-map treatment to load under bare. - imports map (#node:fs/path/os/url/events/stream/net/http/process) - bare-* deps added - process import explicit in service.js + transports/uds.js - net.connect → net.createConnection (bare-net naming) Proven: pgh on bare uses this hyper-svc to talk to tabertron's production pgv3 daemon over UDS, status/repo/issue/follow-payload all return correct data. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
7e25db3ec3a9dcf014fcca2fcee88918dce2355a
by plankatron <fleeky@gmail.com> · 2026-05-20T00:41:37.000Z

Changed files (6) +97 -29

lib/client.js +6 -6
……@@ -20,11 +20,11 @@
2020 * await client.close()
2121 */
2222
23import net from 'net'
24import http from 'http'
25import { URL } from 'url'
23import net from '#node:net'
24import http from '#node:http'
25import { URL } from '#node:url'
2626import b4a from 'b4a'
27import { stat } from 'fs/promises'
27import { stat } from '#node:fs/promises'
2828import Hyperswarm from 'hyperswarm'
2929import Protomux from 'protomux'
3030import crypto from 'hypercore-crypto'
……@@ -69,7 +69,7 @@ export class Client {
6969 }
7070
7171 static async connectUds (path) {
72 const sock = net.connect(path)
72 const sock = net.createConnection(path)
7373 await new Promise((resolve, reject) => {
7474 sock.once('connect', () => {
7575 sock.removeListener('error', reject)
……@@ -276,7 +276,7 @@ async function udsReachable (path) {
276276 }
277277 // Try a real connect — covers stale sockets where the daemon crashed
278278 return new Promise((resolve) => {
279 const sock = net.connect(path)
279 const sock = net.createConnection(path)
280280 sock.once('connect', () => {
281281 sock.destroy()
282282 resolve(true)
lib/service.js +1 -0
……@@ -30,6 +30,7 @@
3030 * await svc.listen()
3131 */
3232
33import process from '#node:process'
3334import ReadyResource from 'ready-resource'
3435import { UdsServer } from './transports/uds.js'
3536import { HttpServer } from './transports/http.js'
lib/transports/http.js +1 -1
……@@ -19,7 +19,7 @@
1919 * 'request' listeners or, if none, returns 404.
2020 */
2121
22import http from 'http'
22import http from '#node:http'
2323import b4a from 'b4a'
2424
2525export class HttpServer {
lib/transports/uds.js +4 -3
……@@ -13,8 +13,9 @@
1313 * a slow handler doesn't block other requests on the same connection.
1414 */
1515
16import net from 'net'
17import { unlink, stat } from 'fs/promises'
16import process from '#node:process'
17import net from '#node:net'
18import { unlink, stat } from '#node:fs/promises'
1819import { encodeFrame, FrameDecoder } from '../frame.js'
1920
2021export class UdsServer {
……@@ -72,7 +73,7 @@ export class UdsServer {
7273
7374 _probe () {
7475 return new Promise((resolve) => {
75 const sock = net.connect(this._path)
76 const sock = net.createConnection(this._path)
7677 sock.once('connect', () => {
7778 sock.destroy()
7879 resolve(true)
package-lock.json +58 -18
……@@ -9,6 +9,15 @@
99 "version": "0.1.0",
1010 "dependencies": {
1111 "b4a": "^1.6.0",
12 "bare-events": "^2.0.0",
13 "bare-fs": "^4.0.0",
14 "bare-http1": "^4.0.0",
15 "bare-net": "^1.0.0",
16 "bare-os": "^3.0.0",
17 "bare-path": "^3.0.0",
18 "bare-process": "^4.0.0",
19 "bare-stream": "^2.0.0",
20 "bare-url": "^2.0.0",
1221 "compact-encoding": "^2.0.0",
1322 "hypercore-crypto": "^3.0.0",
1423 "hyperswarm": "^4.0.0",
……@@ -20,6 +29,10 @@
2029 "brittle": "^3.0.0",
2130 "corestore": "^7.0.0",
2231 "hyper-rooms": "file:../hyper-rooms"
32 },
33 "engines": {
34 "bare": ">=1.0",
35 "node": ">=18"
2336 }
2437 },
2538 "../hyper-rooms": {
……@@ -130,7 +143,6 @@
130143 "version": "2.0.13",
131144 "resolved": "https://registry.npmjs.org/bare-abort/-/bare-abort-2.0.13.tgz",
132145 "integrity": "sha512-zdc8l88eB11Jsz5rDd6sCAgv2kUFXgdrZWoMlgU6JMkfAi1/uuGFC3IEHswKbIRQTk5H3T5CMuechsXYxiaHlQ==",
133 "dev": true,
134146 "license": "Apache-2.0"
135147 },
136148 "node_modules/bare-addon-resolve": {
……@@ -246,7 +258,6 @@
246258 "version": "2.1.4",
247259 "resolved": "https://registry.npmjs.org/bare-dns/-/bare-dns-2.1.4.tgz",
248260 "integrity": "sha512-abwjHmpWqSRNB7V5615QxPH92L71AVzFm/kKTs8VYiNTAi2xVdonpv0BjJ0hwXLwomoW+xsSOPjW6PZPO14asg==",
249 "dev": true,
250261 "license": "Apache-2.0",
251262 "engines": {
252263 "bare": ">=1.7.0"
……@@ -271,7 +282,6 @@
271282 "version": "3.0.0",
272283 "resolved": "https://registry.npmjs.org/bare-env/-/bare-env-3.0.0.tgz",
273284 "integrity": "sha512-0u964P5ZLAxTi+lW4Kjp7YRJQ5gZr9ycYOtjLxsSrupgMz3sn5Z9n4SH/JIifHwvadsf1brA2JAjP+9IOWwTiw==",
274 "dev": true,
275285 "license": "Apache-2.0",
276286 "dependencies": {
277287 "bare-os": "^3.0.1"
……@@ -329,21 +339,18 @@
329339 "version": "2.1.1",
330340 "resolved": "https://registry.npmjs.org/bare-hrtime/-/bare-hrtime-2.1.1.tgz",
331341 "integrity": "sha512-VMb3tHo05gsnbu3OXTmkDiwTjMlOsbQmKoysKqKEyR09m77TuDrYFbj3Q5GGk10dAKsUHrnXmwCaeJqzVpB5ZA==",
332 "dev": true,
333342 "license": "Apache-2.0"
334343 },
335344 "node_modules/bare-http-parser": {
336345 "version": "1.1.3",
337346 "resolved": "https://registry.npmjs.org/bare-http-parser/-/bare-http-parser-1.1.3.tgz",
338347 "integrity": "sha512-+dhVvQi6brHq14L/XHNRQ+TLuVE76VjRmMt61wVEtS+Od8xUslfMHWJN/ZjIIt3RtTG6vPuA+x9cOh7KrkBJsA==",
339 "dev": true,
340348 "license": "Apache-2.0"
341349 },
342350 "node_modules/bare-http1": {
343351 "version": "4.5.6",
344352 "resolved": "https://registry.npmjs.org/bare-http1/-/bare-http1-4.5.6.tgz",
345353 "integrity": "sha512-31OAwMkSU+z1VuUOCk65hx3aWQgzCfH/zQ6LGxbJtmiy2Czsw0+uvOBM9YkqaL6zUSTSYG2pLbL0v/TjME3Buw==",
346 "dev": true,
347354 "license": "Apache-2.0",
348355 "dependencies": {
349356 "bare-events": "^2.6.0",
……@@ -475,16 +482,42 @@
475482 }
476483 },
477484 "node_modules/bare-net": {
478 "version": "2.3.1",
479 "resolved": "https://registry.npmjs.org/bare-net/-/bare-net-2.3.1.tgz",
480 "integrity": "sha512-MypSqDKpDU2Xt7FIfazn5yGvRnV09gFcIPHGWstW0gxuzA4tucTcwJSZeos97C4F89vtU5oGwXDN/HrGN6Y4Jw==",
481 "dev": true,
485 "version": "1.0.1",
486 "resolved": "https://registry.npmjs.org/bare-net/-/bare-net-1.0.1.tgz",
487 "integrity": "sha512-eTMpS2fxXiuz5eMvMGEkJBsgIfanPFoniiepCmgbCRQVdAIjg1wutaRzHTqRJpuG4yCzrcar581AIPf1XzyH8g==",
482488 "license": "Apache-2.0",
483489 "dependencies": {
484490 "bare-events": "^2.2.2",
485 "bare-pipe": "^4.0.0",
491 "bare-pipe": "^3.2.0",
486492 "bare-stream": "^2.0.0",
487 "bare-tcp": "^2.0.0"
493 "bare-tcp": "^1.4.0"
494 }
495 },
496 "node_modules/bare-net/node_modules/bare-dns": {
497 "version": "1.0.5",
498 "resolved": "https://registry.npmjs.org/bare-dns/-/bare-dns-1.0.5.tgz",
499 "integrity": "sha512-Hqb9dpUe4M7y9N6oRV0XhHzUkUliyUE7qw/q3cmn0PF06fdBXooy45fvKGeYUUv6OCvXyLKfi7b7QyZS7r/YoQ==",
500 "license": "Apache-2.0"
501 },
502 "node_modules/bare-net/node_modules/bare-pipe": {
503 "version": "3.3.8",
504 "resolved": "https://registry.npmjs.org/bare-pipe/-/bare-pipe-3.3.8.tgz",
505 "integrity": "sha512-X8Ulz/os6LR/cF5HBljq/tJ0NP7eNGjiripZF53EMtgkhJ9FVl1/WLZxwvUvcqbR82Ywaq6KYM+A6zS7DGPPUw==",
506 "license": "Apache-2.0",
507 "dependencies": {
508 "bare-events": "^2.0.0",
509 "bare-stream": "^2.0.0"
510 }
511 },
512 "node_modules/bare-net/node_modules/bare-tcp": {
513 "version": "1.9.1",
514 "resolved": "https://registry.npmjs.org/bare-tcp/-/bare-tcp-1.9.1.tgz",
515 "integrity": "sha512-eaiKHR0ECRrIrsVNVIjoJxA6J08YqR/kSQ5Ikd0nRmgp5qtKxt49PS0z+USfcN5ZsfDcVFpUFo108EAeXtCshA==",
516 "license": "Apache-2.0",
517 "dependencies": {
518 "bare-dns": "^1.0.0",
519 "bare-events": "^2.2.2",
520 "bare-stream": "^2.0.0"
488521 }
489522 },
490523 "node_modules/bare-os": {
……@@ -509,7 +542,6 @@
509542 "version": "4.1.5",
510543 "resolved": "https://registry.npmjs.org/bare-pipe/-/bare-pipe-4.1.5.tgz",
511544 "integrity": "sha512-6OfxaG8JSkRh3Gc4hzHRsxNt+yu2PpN7lrv1V+T78GdknWQkVGwiEvu4m+1nbfk8cMVQ0TGxRvQ90XA4rhnTuw==",
512 "dev": true,
513545 "license": "Apache-2.0",
514546 "dependencies": {
515547 "bare-events": "^2.0.0",
……@@ -523,7 +555,6 @@
523555 "version": "4.4.1",
524556 "resolved": "https://registry.npmjs.org/bare-process/-/bare-process-4.4.1.tgz",
525557 "integrity": "sha512-JfcTtymq6akqM2bdyTsP4A4GYJceBzb91k/ECmFps75uFf6uO33SM1bOZsRAqyRXExabsQJLn5S41NBl8HTM4A==",
526 "dev": true,
527558 "license": "Apache-2.0",
528559 "dependencies": {
529560 "bare-abort": "^2.0.13",
……@@ -545,7 +576,6 @@
545576 "version": "4.2.0",
546577 "resolved": "https://registry.npmjs.org/bare-signals/-/bare-signals-4.2.0.tgz",
547578 "integrity": "sha512-fNHMOdQIlYuTvMB3Oh9Apk99hLKn351+Ir8vz+khiPTcOqIyGG4uWWjdLTzxWdYGsA0eT+We3y0K74hjj2nq7A==",
548 "dev": true,
549579 "license": "Apache-2.0",
550580 "dependencies": {
551581 "bare-events": "^2.5.3",
……@@ -559,7 +589,6 @@
559589 "version": "1.0.2",
560590 "resolved": "https://registry.npmjs.org/bare-stdio/-/bare-stdio-1.0.2.tgz",
561591 "integrity": "sha512-3WJDqtvVGP4f+j68kyEC05umOYNwKJ1xG+YAXL8yZ605WgNqiRhVaFq+mVIhBt2eKNp7pa5vCQdhOt1pNh79SA==",
562 "dev": true,
563592 "license": "Apache-2.0",
564593 "dependencies": {
565594 "bare-fs": "^4.5.2",
……@@ -633,7 +662,6 @@
633662 "version": "2.2.12",
634663 "resolved": "https://registry.npmjs.org/bare-tcp/-/bare-tcp-2.2.12.tgz",
635664 "integrity": "sha512-x8Q1Iw93noY18hU0UlLpdS/AkgsAgD1TN2imSUT9aH2noZdoXo70qGJ8iEj5D+QwgT/1hFgk1gi8BoolYP9TUw==",
636 "dev": true,
637665 "license": "Apache-2.0",
638666 "dependencies": {
639667 "bare-dns": "^2.0.4",
……@@ -658,11 +686,23 @@
658686 "bare": ">=1.7.0"
659687 }
660688 },
689 "node_modules/bare-tls/node_modules/bare-net": {
690 "version": "2.3.1",
691 "resolved": "https://registry.npmjs.org/bare-net/-/bare-net-2.3.1.tgz",
692 "integrity": "sha512-MypSqDKpDU2Xt7FIfazn5yGvRnV09gFcIPHGWstW0gxuzA4tucTcwJSZeos97C4F89vtU5oGwXDN/HrGN6Y4Jw==",
693 "dev": true,
694 "license": "Apache-2.0",
695 "dependencies": {
696 "bare-events": "^2.2.2",
697 "bare-pipe": "^4.0.0",
698 "bare-stream": "^2.0.0",
699 "bare-tcp": "^2.0.0"
700 }
701 },
661702 "node_modules/bare-tty": {
662703 "version": "5.1.0",
663704 "resolved": "https://registry.npmjs.org/bare-tty/-/bare-tty-5.1.0.tgz",
664705 "integrity": "sha512-EZLvW4A+XiJgI3TW+e1pMME9PIJsfEXe/DA/WSKzIkq/v7Yarpv/rvG6Z5pGnpo4V/Bd+qopwnCLSR71hMMBYA==",
665 "dev": true,
666706 "license": "Apache-2.0",
667707 "dependencies": {
668708 "bare-events": "^2.2.0",
package.json +27 -1
……@@ -5,10 +5,36 @@
55 "type": "module",
66 "main": "index.js",
77 "scripts": {
8 "test": "brittle test/*.test.js"
8 "test": "brittle test/*.test.js",
9 "test:bare": "bare ./node_modules/.bin/brittle test/*.test.js"
10 },
11 "engines": {
12 "node": ">=18",
13 "bare": ">=1.0"
14 },
15 "imports": {
16 "#node:fs": { "bare": "bare-fs", "default": "fs" },
17 "#node:fs/promises": { "bare": "bare-fs/promises", "default": "fs/promises" },
18 "#node:path": { "bare": "bare-path", "default": "path" },
19 "#node:os": { "bare": "bare-os", "default": "os" },
20 "#node:url": { "bare": "bare-url", "default": "url" },
21 "#node:events": { "bare": "bare-events", "default": "events" },
22 "#node:stream": { "bare": "bare-stream", "default": "stream" },
23 "#node:net": { "bare": "bare-net", "default": "net" },
24 "#node:http": { "bare": "bare-http1", "default": "http" },
25 "#node:process": { "bare": "bare-process", "default": "process" }
926 },
1027 "dependencies": {
1128 "b4a": "^1.6.0",
29 "bare-events": "^2.0.0",
30 "bare-fs": "^4.0.0",
31 "bare-http1": "^4.0.0",
32 "bare-net": "^1.0.0",
33 "bare-os": "^3.0.0",
34 "bare-path": "^3.0.0",
35 "bare-process": "^4.0.0",
36 "bare-stream": "^2.0.0",
37 "bare-url": "^2.0.0",
1238 "compact-encoding": "^2.0.0",
1339 "hypercore-crypto": "^3.0.0",
1440 "hyperswarm": "^4.0.0",