OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-svc commits / b63c8b2

test harness + examples: run green under bare
Bridge raw node-builtin imports to #node:* so test:bare passes: - test/basic.test.js: static fs/os/path + dynamic import('http') -> #node:* - examples/cli.js, examples/web.js: fs/promises, path -> #node:*; add `import process from #node:process` (was relying on the node global) The dynamic import('http') was invisible to static scanning and only caught by actually running under bare. 22/22 tests, 48/48 asserts under BOTH runtimes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
b63c8b25fdd74cfc65f34314f12cc1238072e1ab
by plankatron <fleeky@gmail.com> · 2026-06-04T15:24:37.000Z

Changed files (3) +11 -9

examples/cli.js +3 -2
……@@ -22,8 +22,9 @@
2222 */
2323
2424import { Service, Client } from '../index.js'
25import { mkdir } from 'fs/promises'
26import { join, dirname } from 'path'
25import { mkdir } from '#node:fs/promises'
26import { join, dirname } from '#node:path'
27import process from '#node:process'
2728
2829const storagePath = process.env.HYPER_SVC_STORE || './.hyper-svc-cli'
2930const sockPath = process.env.HYPER_SVC_SOCK || join(storagePath, 'svc.sock')
examples/web.js +3 -2
……@@ -19,8 +19,9 @@
1919
2020import { Service } from '../index.js'
2121import b4a from 'b4a'
22import { mkdir } from 'fs/promises'
23import { join, dirname } from 'path'
22import { mkdir } from '#node:fs/promises'
23import { join, dirname } from '#node:path'
24import process from '#node:process'
2425
2526const args = process.argv.slice(2)
2627function getFlag (name) {
test/basic.test.js +5 -5
……@@ -2,9 +2,9 @@ import test from 'brittle'
22import Corestore from 'corestore'
33import { Room, jsonSchema } from 'hyper-rooms'
44import createTestnet from '@hyperswarm/testnet'
5import { mkdtempSync } from 'fs'
6import { join } from 'path'
7import { tmpdir } from 'os'
5import { mkdtempSync } from '#node:fs'
6import { join } from '#node:path'
7import { tmpdir } from '#node:os'
88import b4a from 'b4a'
99
1010import { Service, Client, encodeFrame, FrameDecoder } from '../index.js'
……@@ -452,7 +452,7 @@ async function waitFor (predicate, timeoutMs) {
452452
453453function fetchText (url) {
454454 return new Promise((resolve, reject) => {
455 import('http').then(({ default: http }) => {
455 import('#node:http').then(({ default: http }) => {
456456 http.get(url, (res) => {
457457 const parts = []
458458 res.on('data', (c) => parts.push(c))
……@@ -465,7 +465,7 @@ function fetchText (url) {
465465
466466function fetchJson (url, body) {
467467 return new Promise((resolve, reject) => {
468 import('http').then(({ default: http }) => {
468 import('#node:http').then(({ default: http }) => {
469469 const u = new URL(url)
470470 const req = http.request({
471471 method: 'POST',