Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit d884f05

Browse files
committed
feat: Provide access to bundled libraries when in browser
1 parent e189b72 commit d884f05

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,13 @@ A set of data types are exposed directly from the IPFS instance under `ipfs.type
366366
- [`ipfs.types.PeerId`](https://github.com/libp2p/js-peer-id)
367367
- [`ipfs.types.PeerInfo`](https://github.com/libp2p/js-peer-info)
368368
- [`ipfs.types.multiaddr`](https://github.com/multiformats/js-multiaddr)
369+
- [`ipfs.types.multibase`](https://github.com/multiformats/multibase)
369370
- [`ipfs.types.multihash`](https://github.com/multiformats/js-multihash)
370371
- [`ipfs.types.CID`](https://github.com/ipld/js-cid)
372+
- [`ipfs.types.crypto`](https://github.com/libp2p/js-libp2p-crypto)
373+
- [`ipfs.types.dagPB`](https://github.com/ipld/js-ipld-dag-pb)
374+
- [`ipfs.types.dagCBOR`](https://github.com/ipld/js-ipld-dag-cbor)
375+
- [`ipfs.types.isIPFS`](https://github.com/ipfs-shipyard/is-ipfs)
371376

372377
## FAQ
373378

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,16 @@
115115
"ipfs-unixfs": "~0.1.14",
116116
"ipfs-unixfs-engine": "~0.27.0",
117117
"ipld": "^0.15.0",
118+
"ipld-dag-cbor": "^0.12.0",
119+
"ipld-dag-pb": "^0.13.1",
118120
"is-ipfs": "^0.3.2",
119121
"is-stream": "^1.1.0",
120122
"joi": "^13.1.2",
121123
"joi-browser": "^13.0.1",
122124
"joi-multiaddr": "^1.0.1",
123125
"libp2p": "~0.19.2",
124126
"libp2p-circuit": "~0.1.5",
127+
"libp2p-crypto": "^0.12.1",
125128
"libp2p-floodsub": "~0.14.1",
126129
"libp2p-kad-dht": "~0.9.0",
127130
"libp2p-keychain": "~0.3.1",
@@ -141,6 +144,7 @@
141144
"mime-types": "^2.1.18",
142145
"mkdirp": "~0.5.1",
143146
"multiaddr": "^3.1.0",
147+
"multibase": "^0.4.0",
144148
"multihashes": "~0.4.13",
145149
"once": "^1.4.0",
146150
"path-exists": "^3.0.0",

src/core/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ const BlockService = require('ipfs-block-service')
44
const Ipld = require('ipld')
55
const PeerId = require('peer-id')
66
const PeerInfo = require('peer-info')
7+
const dagCBOR = require('ipld-dag-cbor')
8+
const dagPB = require('ipld-dag-pb')
9+
const crypto = require('libp2p-crypto')
10+
const isIPFS = require('is-ipfs')
711
const multiaddr = require('multiaddr')
812
const multihash = require('multihashes')
913
const PeerBook = require('peer-book')
14+
const multibase = require('multibase')
1015
const CID = require('cids')
1116
const debug = require('debug')
1217
const extend = require('deep-extend')
@@ -58,8 +63,13 @@ class IPFS extends EventEmitter {
5863
PeerId: PeerId,
5964
PeerInfo: PeerInfo,
6065
multiaddr: multiaddr,
66+
multibase: multibase,
6167
multihash: multihash,
62-
CID: CID
68+
CID: CID,
69+
crypto: crypto,
70+
dagPB: dagPB,
71+
dagCBOR: dagCBOR,
72+
isIPFS: isIPFS
6373
}
6474

6575
// IPFS Core Internals

test/core/init.spec.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ const isNode = require('detect-node')
1010
const hat = require('hat')
1111
const PeerId = require('peer-id')
1212
const PeerInfo = require('peer-info')
13+
const dagCBOR = require('ipld-dag-cbor')
14+
const dagPB = require('ipld-dag-pb')
15+
const crypto = require('libp2p-crypto')
16+
const isIPFS = require('is-ipfs')
1317
const multiaddr = require('multiaddr')
18+
const multibase = require('multibase')
1419
const multihash = require('multihashes')
1520
const CID = require('cids')
1621
const IPFS = require('../../src/core')
@@ -101,8 +106,13 @@ describe('init', () => {
101106
PeerId: PeerId,
102107
PeerInfo: PeerInfo,
103108
multiaddr: multiaddr,
109+
multibase: multibase,
104110
multihash: multihash,
105-
CID: CID
111+
CID: CID,
112+
crypto: crypto,
113+
dagPB: dagPB,
114+
dagCBOR: dagCBOR,
115+
isIPFS: isIPFS
106116
})
107117
})
108118
})

0 commit comments

Comments
 (0)