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 124
feat: Provide access to bundled libraries when in browser #252
Merged
daviddias
merged 1 commit into
master
from
feat_provide-access-to-bundled-libraries-when-in-browser
Apr 5, 2018
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
TYPES API | ||
======= | ||
|
||
A set of data types are exposed directly from the IPFS instance under `ipfs.types`. That way you're not required to import/require the following. | ||
|
||
- [`ipfs.types.Buffer`](https://www.npmjs.com/package/buffer) | ||
- [`ipfs.types.PeerId`](https://github.com/libp2p/js-peer-id) | ||
- [`ipfs.types.PeerInfo`](https://github.com/libp2p/js-peer-info) | ||
- [`ipfs.types.multiaddr`](https://github.com/multiformats/js-multiaddr) | ||
- [`ipfs.types.multibase`](https://github.com/multiformats/multibase) | ||
- [`ipfs.types.multihash`](https://github.com/multiformats/js-multihash) | ||
- [`ipfs.types.CID`](https://github.com/ipld/js-cid) | ||
- [`ipfs.types.dagPB`](https://github.com/ipld/js-ipld-dag-pb) | ||
- [`ipfs.types.dagCBOR`](https://github.com/ipld/js-ipld-dag-cbor) |
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,7 @@ | ||
UTIL API | ||
======= | ||
|
||
A set of utils are exposed directly from the IPFS instance under `ipfs.util`. That way you're not required to import/require the following: | ||
|
||
- [`ipfs.util.crypto`](https://github.com/libp2p/js-libp2p-crypto) | ||
- [`ipfs.util.isIPFS`](https://github.com/ipfs-shipyard/is-ipfs) |
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,53 @@ | ||
/* 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 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) | ||
|
||
describe('.types', function () { | ||
let ipfs | ||
|
||
before(function (done) { | ||
// CI takes longer to instantiate the daemon, so we need to increase the | ||
// timeout for the before step | ||
this.timeout(60 * 1000) | ||
|
||
common.setup((err, factory) => { | ||
expect(err).to.not.exist() | ||
factory.spawnNode((err, node) => { | ||
expect(err).to.not.exist() | ||
ipfs = node | ||
done() | ||
}) | ||
}) | ||
}) | ||
|
||
after((done) => { | ||
common.teardown(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, | ||
dagPB: dagPB, | ||
dagCBOR: dagCBOR | ||
}) | ||
}) | ||
}) |
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,40 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const crypto = require('libp2p-crypto') | ||
const isIPFS = require('is-ipfs') | ||
|
||
const chai = require('chai') | ||
const dirtyChai = require('dirty-chai') | ||
const expect = chai.expect | ||
chai.use(dirtyChai) | ||
util | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That util was supposed to be inside There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vasco-santos yes please. |
||
describe('.types', function () { | ||
let ipfs | ||
|
||
before(function (done) { | ||
// CI takes longer to instantiate the daemon, so we need to increase the | ||
// timeout for the before step | ||
this.timeout(60 * 1000) | ||
|
||
common.setup((err, factory) => { | ||
expect(err).to.not.exist() | ||
factory.spawnNode((err, node) => { | ||
expect(err).to.not.exist() | ||
ipfs = node | ||
done() | ||
}) | ||
}) | ||
}) | ||
|
||
after((done) => { | ||
common.teardown(done) | ||
}) | ||
|
||
it('util object', () => { | ||
expect(ipfs.util).to.be.deep.equal({ | ||
crypto: crypto, | ||
isIPFS: isIPFS | ||
}) | ||
}) | ||
}) |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these runnable? There's no
module.exports = (common) => {
wrapper and no entry injs/src/index.js
for them.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well noticed, I have to update this with the other typo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vasco-santos did you open a new PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is created now 🙂