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

Commit

Permalink
feat: remove esoteric ipld formats
Browse files Browse the repository at this point in the history
We bundle ipld formats for ethereum, zcash, bitcoin and git though they
speak beyond the files part of the Interplanetary File System.

Since #3347 we can now configure extra IPLD formats in the http client,
in-process and daemon nodes, we no longer have to bundle these formats
for them to be supported, instead the user can choose to configure their
node with the formats they require.

This makes the behaviour of core the same in node as it is in the browser
and also means we don't waste time installing deps our users may not use.

If they do use them, they can configure the node as they see fit.

BREAKING CHANGE: only dag-pb, dag-cbor and raw formats are supported out
  of the box, any others will need to be configured during node startup.
  • Loading branch information
achingbrain committed Oct 29, 2020
1 parent 4da0e33 commit 5d9d2de
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 56 deletions.
5 changes: 0 additions & 5 deletions packages/ipfs-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"./src/runtime/libp2p-pubsub-routers-nodejs.js": "./src/runtime/libp2p-pubsub-routers-browser.js",
"./src/runtime/preload-nodejs.js": "./src/runtime/preload-browser.js",
"./src/runtime/repo-nodejs.js": "./src/runtime/repo-browser.js",
"./src/runtime/ipld-nodejs.js": "./src/runtime/ipld-browser.js",
"./test/utils/create-repo-nodejs.js": "./test/utils/create-repo-browser.js",
"ipfs-utils/src/files/glob-source": false
},
Expand Down Expand Up @@ -78,14 +77,10 @@
"ipfs-unixfs-importer": "^3.0.4",
"ipfs-utils": "^4.0.0",
"ipld": "^0.27.2",
"ipld-bitcoin": "^0.4.0",
"ipld-block": "^0.10.1",
"ipld-dag-cbor": "^0.17.0",
"ipld-dag-pb": "^0.20.0",
"ipld-ethereum": "^5.0.1",
"ipld-git": "^0.6.1",
"ipld-raw": "^6.0.0",
"ipld-zcash": "^0.5.0",
"ipns": "^0.8.0",
"is-domain-name": "^1.0.1",
"is-ipfs": "^2.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/ipfs-core/src/components/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const BlockService = require('ipfs-block-service')
* @typedef {import('.').IPLD} IPLD
*/
const Ipld = require('ipld')
const getDefaultIpldOptions = require('../runtime/ipld-nodejs')
const getDefaultIpldOptions = require('../runtime/ipld')

const createPreloader = require('../preload')
const { ERR_REPO_NOT_INITIALIZED } = require('ipfs-repo').errors
Expand Down Expand Up @@ -486,8 +486,8 @@ function createApi ({
* @property {import('.').IPLDConfig} [ipld] - Modify the default IPLD config. This object
* will be *merged* with the default config; it will not replace it. Check IPLD
* [docs](https://github.com/ipld/js-ipld#ipld-constructor) for more information
* on the available options. (Default: [`ipld-nodejs.js`]
* (https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/src/core/runtime/ipld-nodejs.js) in Node.js, [`ipld-browser.js`](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/src/core/runtime/ipld-browser.js)
* on the available options. (Default: [`ipld.js`]
* (https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/src/core/runtime/ipld.js)
* in browsers)
* @property {object|Function} [libp2p] - The libp2p option allows you to build
* your libp2p node by configuration, or via a bundle function. If you are
Expand Down
4 changes: 2 additions & 2 deletions packages/ipfs-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ module.exports = {
* @property {import('./components').IPLDConfig} [ipld] - Modify the default IPLD config. This object
* will be *merged* with the default config; it will not replace it. Check IPLD
* [docs](https://github.com/ipld/js-ipld#ipld-constructor) for more information
* on the available options. (Default: [`ipld-nodejs.js`]
* (https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/src/core/runtime/ipld-nodejs.js) in Node.js, [`ipld-browser.js`](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/src/core/runtime/ipld-browser.js)
* on the available options. (Default: [`ipld.js`]
* (https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/src/core/runtime/ipld.js)
* in browsers)
* @property {object|Function} [libp2p] - The libp2p option allows you to build
* your libp2p node by configuration, or via a bundle function. If you are
Expand Down
15 changes: 0 additions & 15 deletions packages/ipfs-core/src/runtime/ipld-browser.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,6 @@ const IpldFormats = {
},
get [multicodec.RAW] () {
return require('ipld-raw')
},
get [multicodec.BITCOIN_BLOCK] () {
return require('ipld-bitcoin')
},
get [multicodec.ETH_ACCOUNT_SNAPSHOT] () {
return require('ipld-ethereum').ethAccountSnapshot
},
get [multicodec.ETH_BLOCK] () {
return require('ipld-ethereum').ethBlock
},
get [multicodec.ETH_BLOCK_LIST] () {
return require('ipld-ethereum').ethBlockList
},
get [multicodec.ETH_STATE_TRIE] () {
return require('ipld-ethereum').ethStateTrie
},
get [multicodec.ETH_STORAGE_TRIE] () {
return require('ipld-ethereum').ethStorageTrie
},
get [multicodec.ETH_TX] () {
return require('ipld-ethereum').ethTx
},
get [multicodec.ETH_TX_TRIE] () {
return require('ipld-ethereum').ethTxTrie
},
get [multicodec.GIT_RAW] () {
return require('ipld-git')
},
get [multicodec.ZCASH_BLOCK] () {
return require('ipld-zcash')
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs/docs/MODULE.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Modify the default IPFS node config. This object will be *merged* with the defau
| Type | Default |
|------|---------|
| object | [`ipld-nodejs.js`](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/src/core/runtime/ipld-nodejs.js) in Node.js, [`ipld-browser.js`](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/src/core/runtime/ipld-browser.js) in browsers |
| object | [`ipld.js`](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/src/core/runtime/ipld.js) |
Modify the default IPLD config. This object will be *merged* with the default config; it will not replace it. Check IPLD [docs](https://github.com/ipld/js-ipld#ipld-constructor) for more information on the available options.
Expand Down

0 comments on commit 5d9d2de

Please sign in to comment.