This repository has been archived by the owner on Mar 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Provide access to bundled libraries when in browser
Close #406
- Loading branch information
1 parent
41d32e3
commit 3d4b90a
Showing
6 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict' | ||
|
||
const CID = require('cids') | ||
const crypto = require('libp2p-crypto') | ||
const dagCBOR = require('ipld-dag-cbor') | ||
const dagPB = require('ipld-dag-pb') | ||
const isIPFS = require('is-ipfs') | ||
const multiaddr = require('multiaddr') | ||
const multibase = require('multibase') | ||
const multihash = require('multihashes') | ||
const PeerId = require('peer-id') | ||
const PeerInfo = require('peer-info') | ||
|
||
module.exports = () => ({ | ||
Buffer: Buffer, | ||
CID: CID, | ||
crypto: crypto, | ||
dagPB: dagPB, | ||
dagCBOR: dagCBOR, | ||
isIPFS: isIPFS, | ||
multiaddr: multiaddr, | ||
multibase: multibase, | ||
multihash: multihash, | ||
PeerId: PeerId, | ||
PeerInfo: PeerInfo | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const PeerId = require('peer-id') | ||
const PeerInfo = require('peer-info') | ||
const dagCBOR = require('ipld-dag-cbor') | ||
const dagPB = require('ipld-dag-pb') | ||
const crypto = require('libp2p-crypto') | ||
const isIPFS = require('is-ipfs') | ||
const multiaddr = require('multiaddr') | ||
const multibase = require('multibase') | ||
const multihash = require('multihashes') | ||
const CID = require('cids') | ||
|
||
const chai = require('chai') | ||
const dirtyChai = require('dirty-chai') | ||
const expect = chai.expect | ||
chai.use(dirtyChai) | ||
|
||
const IPFSApi = require('../src') | ||
|
||
const f = require('./utils/factory') | ||
|
||
describe('.types', function () { | ||
this.timeout(20 * 1000) | ||
|
||
let ipfsd | ||
let ipfs | ||
|
||
before((done) => { | ||
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => { | ||
expect(err).to.not.exist() | ||
ipfsd = _ipfsd | ||
ipfs = IPFSApi(_ipfsd.apiAddr) | ||
done() | ||
}) | ||
}) | ||
|
||
after((done) => ipfsd.stop(done)) | ||
|
||
it('types object', () => { | ||
expect(ipfs.types).to.be.deep.equal({ | ||
Buffer: Buffer, | ||
PeerId: PeerId, | ||
PeerInfo: PeerInfo, | ||
multiaddr: multiaddr, | ||
multibase: multibase, | ||
multihash: multihash, | ||
CID: CID, | ||
crypto: crypto, | ||
dagPB: dagPB, | ||
dagCBOR: dagCBOR, | ||
isIPFS: isIPFS | ||
}) | ||
}) | ||
}) |