-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactors the code to be ESM. Dual publishes CJS and ESM for maximum compatibility. There are no default exports, so code similar to: ```js import IPFS from 'ipfs' const ipfs = await IPFS.create() ``` should be refactored to: ```js import { create } as IPFS from 'ipfs' const ipfs = await create() ``` BREAKING CHANGE: There are no default exports and everything is now dual published as ESM/CJS
- Loading branch information
1 parent
95c1fee
commit 3dcf3ec
Showing
187 changed files
with
1,418 additions
and
1,717 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 |
---|---|---|
|
@@ -9,15 +9,28 @@ | |
"bugs": "https://github.com/ipfs/js-ipfs/issues", | ||
"license": "(Apache-2.0 OR MIT)", | ||
"leadMaintainer": "Alex Potsides <[email protected]>", | ||
"type": "module", | ||
"main": "src/index.js", | ||
"types": "types/src/index.d.ts", | ||
"files": [ | ||
"src", | ||
"dist", | ||
"!dist/*.tsbuildinfo" | ||
"*", | ||
"!**/*.tsbuildinfo" | ||
], | ||
"main": "src/index.js", | ||
"types": "./dist/src/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./src/index.js" | ||
} | ||
}, | ||
"eslintConfig": { | ||
"extends": "ipfs", | ||
"parserOptions": { | ||
"sourceType": "module" | ||
} | ||
}, | ||
"publishConfig": { | ||
"directory": "dist" | ||
}, | ||
"browser": { | ||
"./src/lib/multipart-request.js": "./src/lib/multipart-request.browser.js", | ||
"ipfs-utils/src/files/glob-source": false, | ||
"go-ipfs": false, | ||
"ipfs-core-utils/src/files/normalise-input": "ipfs-core-utils/src/files/normalise-input/index.browser.js", | ||
|
@@ -34,8 +47,8 @@ | |
"test:node": "aegir test -t node", | ||
"test:browser": "aegir test -t browser", | ||
"test:webworker": "aegir test -t webworker", | ||
"test:electron-main": "aegir test -t electron-main", | ||
"test:electron-renderer": "aegir test -t electron-renderer", | ||
"test:electron-main": "aegir build --esm-tests && aegir test -t electron-main -f ./dist/cjs/node-test/*.spec.js", | ||
"test:electron-renderer": "aegir build --esm-tests && aegir test -t electron-renderer -f ./dist/cjs/browser-test/*.spec.js", | ||
"lint": "aegir ts -p check && aegir lint", | ||
"clean": "rimraf ./dist", | ||
"dep-check": "aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i abort-controller" | ||
|
@@ -47,24 +60,21 @@ | |
"any-signal": "^2.1.2", | ||
"debug": "^4.1.1", | ||
"err-code": "^3.0.1", | ||
"form-data": "^4.0.0", | ||
"ipfs-core-types": "^0.7.3", | ||
"ipfs-core-utils": "^0.10.5", | ||
"ipfs-utils": "^8.1.4", | ||
"it-first": "^1.0.6", | ||
"it-last": "^1.0.4", | ||
"it-to-stream": "^1.0.0", | ||
"merge-options": "^3.0.4", | ||
"multiaddr": "^10.0.0", | ||
"multiformats": "^9.4.1", | ||
"nanoid": "^3.1.12", | ||
"native-abort-controller": "^1.0.3", | ||
"parse-duration": "^1.0.0", | ||
"stream-to-it": "^0.2.2", | ||
"uint8arrays": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"aegir": "^35.0.3", | ||
"aegir": "^35.1.0", | ||
"delay": "^5.0.0", | ||
"go-ipfs": "0.9.1", | ||
"ipfsd-ctl": "^10.0.3", | ||
|
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 |
---|---|---|
@@ -1,11 +1,16 @@ | ||
'use strict' | ||
import { createWantlist } from './wantlist.js' | ||
import { createWantlistForPeer } from './wantlist-for-peer.js' | ||
import { createStat } from './stat.js' | ||
import { createUnwant } from './unwant.js' | ||
|
||
/** | ||
* @param {import('../types').Options} config | ||
*/ | ||
module.exports = config => ({ | ||
wantlist: require('./wantlist')(config), | ||
wantlistForPeer: require('./wantlist-for-peer')(config), | ||
stat: require('./stat')(config), | ||
unwant: require('./unwant')(config) | ||
}) | ||
export function createBitswap (config) { | ||
return { | ||
wantlist: createWantlist(config), | ||
wantlistForPeer: createWantlistForPeer(config), | ||
unwant: createUnwant(config), | ||
stat: createStat(config) | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,11 +1,17 @@ | ||
'use strict' | ||
|
||
import { createGet } from './get.js' | ||
import { createPut } from './put.js' | ||
import { createRm } from './rm.js' | ||
import { createStat } from './stat.js' | ||
|
||
/** | ||
* @param {import('../types').Options} config | ||
*/ | ||
module.exports = config => ({ | ||
get: require('./get')(config), | ||
stat: require('./stat')(config), | ||
put: require('./put')(config), | ||
rm: require('./rm')(config) | ||
}) | ||
export function createBlock (config) { | ||
return { | ||
get: createGet(config), | ||
put: createPut(config), | ||
rm: createRm(config), | ||
stat: createStat(config) | ||
} | ||
} |
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
Oops, something went wrong.