| … | … | @@ -13,8 +13,11 @@ |
| 13 | 13 | // `index` is duck-typed: anything with getChunkMap / getChunkMapByHash works, so |
| 14 | 14 | // this file does not import hyper-overlay (ESM) into a CJS module. |
| 15 | 15 | |
| 16 | const fs = require('fs') | |
| 17 | const path = require('path') | |
| 16 | // Dual-runtime: pgv3 and pgh-sidecar run under Bare, the tests and CLI under Node. | |
| 17 | // Static requires on both branches so bundlers can still see the dependency. | |
| 18 | const { isBare } = require('which-runtime') | |
| 19 | const fs = isBare ? require('bare-fs') : require('fs') | |
| 20 | const path = isBare ? require('bare-path') : require('path') | |
| 18 | 21 | const { ContentStore } = require('./storage.cjs') |
| 19 | 22 | |
| 20 | 23 | class OverlayContentStore extends ContentStore { |
| … | … | @@ -11,7 +11,10 @@ |
| 11 | 11 | // flush — and deleteBlock/deleteBlockRange/truncate free it with no extra work. |
| 12 | 12 | // Cost: 1 byte per literal block, 33 bytes per virtualised block. |
| 13 | 13 | |
| 14 | const fs = require('fs') | |
| 14 | // Dual-runtime: pgv3 and pgh-sidecar run under Bare, the tests and CLI under Node. | |
| 15 | // Static requires on both branches so bundlers can still see the dependency. | |
| 16 | const { isBare } = require('which-runtime') | |
| 17 | const fs = isBare ? require('bare-fs') : require('fs') | |
| 15 | 18 | const crypto = require('hypercore-crypto') |
| 16 | 19 | const CorestoreStorage = require('hypercore-storage') |
| 17 | 20 |
| … | … | @@ -1,9 +1,11 @@ |
| 1 | 1 | { |
| 2 | 2 | "name": "hyper-vdrive", |
| 3 | 3 | "version": "0.0.1", |
| 4 | "description": "A real Hyperdrive that stores no blob bytes — blocks are materialised on demand from a content-addressed store on disk", | |
| 4 | "description": "A real Hyperdrive that stores no blob bytes \u2014 blocks are materialised on demand from a content-addressed store on disk", | |
| 5 | 5 | "main": "lib/storage.cjs", |
| 6 | "bin": { "vdrive": "bin/vdrive.mjs" }, | |
| 6 | "bin": { | |
| 7 | "vdrive": "bin/vdrive.mjs" | |
| 8 | }, | |
| 7 | 9 | "exports": { |
| 8 | 10 | ".": "./lib/storage.cjs", |
| 9 | 11 | "./overlay": "./lib/overlay-content-store.cjs", |
| … | … | @@ -14,13 +16,16 @@ |
| 14 | 16 | "test:gc": "node test/gc-bitfield.mjs ./work/gc" |
| 15 | 17 | }, |
| 16 | 18 | "dependencies": { |
| 19 | "bare-fs": "^4.7.1", | |
| 20 | "bare-path": "^3.0.0", | |
| 17 | 21 | "corestore": "^7.12.0", |
| 18 | 22 | "hypercore": "^11.35.2", |
| 19 | 23 | "hypercore-crypto": "^3.7.0", |
| 20 | 24 | "hypercore-id-encoding": "^1.3.0", |
| 21 | 25 | "hypercore-storage": "^3.2.1", |
| 22 | 26 | "hyperdrive": "^13.3.3", |
| 23 | "hyperswarm": "^4.17.0" | |
| 27 | "hyperswarm": "^4.17.0", | |
| 28 | "which-runtime": "^2.1.1" | |
| 24 | 29 | }, |
| 25 | 30 | "license": "AGPL-3.0-or-later" |
| 26 | 31 | } |