Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

refactor: export types and utilities statically #951

Merged
merged 4 commits into from
Mar 6, 2019

Conversation

alanshaw
Copy link
Contributor

@alanshaw alanshaw commented Mar 5, 2019

Allows users to access these additional types and utilities without having to create an instance of the client first.

resolves #902
refs ipfs/js-ipfs#1908

BREAKING CHANGE: ipfs.util.isIPFS has moved to a static export and should be accessed via const { isIPFS } = require('ipfs-http-client').

The modules available under ipfs.types.* have also become static exports.

ipfs.util.crypto has been removed as it is not a dependency of ipfs-http-client so reduces the bundle size. If you need to use libp2p crypto primitives then please see the js-libp2p-crypto project for info on how to use it in your project.

Finally ipfs.util.getEndpointConfig is now a direct instance method, ipfs.getEndpointConfig

Copy link
Contributor

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, small suggestion below.

README.md Outdated Show resolved Hide resolved
Alan Shaw added 4 commits March 6, 2019 13:22
Allows users to access these additional types and utilities without having to create an instance of the c
lient first.

BREAKING CHANGE: `ipfs.util.isIPFS` has moved to a static export and should be accessed via `const { isIPFS } = require('ipfs-http-client'). The modules available under `ipfs.types.*` have also become static exports. `ipfs.util.crypto` has been removed as it is not a dependency of `ipfs-http-client` so reduces the bundle size. If you need to use libp2p crypto primitives then please see the [js-libp2p-crypto](https://github.com/libp2p/js-libp2p-crypto) project for info on how to use it in your project. Finally `ipfs.util.getEndpointConfig` is now a direct instance method, `ipfs.getEndpointConfig`

resolves #902

License: MIT
Signed-off-by: Alan Shaw <[email protected]>
License: MIT
Signed-off-by: Alan Shaw <[email protected]>
License: MIT
Signed-off-by: Alan Shaw <[email protected]>
@alanshaw alanshaw force-pushed the refactor/static-exports branch from 6189c97 to d47c6a8 Compare March 6, 2019 13:23
@alanshaw alanshaw merged commit d1e99e7 into master Mar 6, 2019
@alanshaw alanshaw deleted the refactor/static-exports branch March 6, 2019 20:23
@ghost ghost removed the in progress label Mar 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: expose types and utils in static context
3 participants