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

Commit e443160

Browse files
committed
chore: upgrade all deps to typed versions
- Uses default aegir ts config - Fixes all ts errors - Fully types core-api in ipfs-core-types package - Makes ipfs-core implement types from ipfs-core-types package - Removes duplicate types, ipfs-core-types as single source of type truth - Reduces use of external APIs by internal components in ipfs-core
1 parent c47a633 commit e443160

File tree

245 files changed

+4362
-4497
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

245 files changed

+4362
-4497
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ node_modules
1919
dist
2020
build
2121
bundle.js
22+
tsconfig-types.aegir.json
2223

2324
# Deployment files
2425
.npmrc

Diff for: examples/browser-browserify/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ document.addEventListener('DOMContentLoaded', async () => {
2525
async function display (cid) {
2626
for await (const data of node.cat(cid)) {
2727
document.getElementById('cid').innerText = cid
28-
document.getElementById('content').innerText = data
28+
document.getElementById('content').innerText = new TextDecoder().decode(data)
2929
document.getElementById('output').setAttribute('style', 'display: block')
3030
}
3131
}

Diff for: examples/browser-ipns-publish/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"ipfs": "^0.54.4",
1717
"ipfs-http-client": "^49.0.4",
1818
"ipfs-utils": "^6.0.1",
19-
"ipns": "^0.8.0",
19+
"ipns": "^0.10.0",
2020
"it-last": "^1.0.4",
2121
"p-retry": "^4.2.0",
2222
"uint8arrays": "^2.1.3"

Diff for: examples/custom-ipfs-repo/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"dependencies": {
1313
"datastore-fs": "^2.0.0",
1414
"ipfs": "^0.54.4",
15-
"ipfs-repo": "^8.0.0",
15+
"ipfs-repo": "^9.0.0",
1616
"it-all": "^1.0.4"
1717
},
1818
"devDependencies": {

Diff for: examples/traverse-ipld-graphs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"cids": "^1.1.5",
1717
"ipfs": "^0.54.4",
1818
"ipld-block": "^0.11.0",
19-
"ipld-dag-pb": "^0.20.0",
19+
"ipld-dag-pb": "^0.22.0",
2020
"ipld-git": "^0.6.1",
2121
"ipld-ethereum": "^5.0.1",
2222
"multihashing-async": "^2.1.2"

Diff for: packages/interface-ipfs-core/package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,20 @@
4343
"chai-as-promised": "^7.1.1",
4444
"chai-subset": "^1.6.0",
4545
"cids": "^1.1.5",
46-
"delay": "^4.4.0",
46+
"delay": "^5.0.0",
4747
"dirty-chai": "^2.0.1",
48-
"err-code": "^2.0.3",
49-
"ipfs-unixfs": "^2.0.3",
50-
"ipfs-unixfs-importer": "^5.0.0",
48+
"err-code": "^3.0.1",
49+
"ipfs-unixfs": "https://gitpkg.now.sh/ipfs/js-ipfs-unixfs/packages/ipfs-unixfs?fix/declare-interface-types-in-d-ts",
50+
"ipfs-unixfs-importer": "https://gitpkg.now.sh/ipfs/js-ipfs-unixfs/packages/ipfs-unixfs-importer?fix/declare-interface-types-in-d-ts",
5151
"ipfs-utils": "^6.0.1",
5252
"ipld-block": "^0.11.0",
53-
"ipld-dag-cbor": "^0.17.0",
54-
"ipld-dag-pb": "^0.20.0",
55-
"ipns": "^0.8.0",
56-
"is-ipfs": "^2.0.0",
53+
"ipld-dag-cbor": "^0.18.0",
54+
"ipld-dag-pb": "^0.22.0",
55+
"ipns": "^0.10.0",
56+
"is-ipfs": "^4.0.0",
5757
"iso-random-stream": "^1.1.1",
5858
"it-all": "^1.0.4",
59-
"it-buffer-stream": "^1.0.5",
59+
"it-buffer-stream": "^2.0.0",
6060
"it-concat": "^1.0.1",
6161
"it-drain": "^1.0.3",
6262
"it-first": "^1.0.4",

Diff for: packages/interface-ipfs-core/src/cat.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const all = require('it-all')
1010
const drain = require('it-drain')
1111
const { getDescribe, getIt, expect } = require('./utils/mocha')
1212
const testTimeout = require('./utils/test-timeout')
13-
const importer = require('ipfs-unixfs-importer')
13+
const { importer } = require('ipfs-unixfs-importer')
1414

1515
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
1616
/**

Diff for: packages/interface-ipfs-core/src/dag/get.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const uint8ArrayFromString = require('uint8arrays/from-string')
55
const dagPB = require('ipld-dag-pb')
66
const DAGNode = dagPB.DAGNode
77
const dagCBOR = require('ipld-dag-cbor')
8-
const importer = require('ipfs-unixfs-importer')
9-
const Unixfs = require('ipfs-unixfs')
8+
const { importer } = require('ipfs-unixfs-importer')
9+
const { UnixFS } = require('ipfs-unixfs')
1010
const all = require('it-all')
1111
const CID = require('cids')
1212
const { getDescribe, getIt, expect } = require('../utils/mocha')
@@ -193,7 +193,7 @@ module.exports = (common, options) => {
193193
const cidv0 = cidv1.toV0()
194194

195195
const output = await ipfs.dag.get(cidv0)
196-
expect(Unixfs.unmarshal(output.value.Data).data).to.eql(input)
196+
expect(UnixFS.unmarshal(output.value.Data).data).to.eql(input)
197197
})
198198

199199
it('should be able to get part of a dag-cbor node', async () => {

Diff for: packages/interface-ipfs-core/src/files/cp.js

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ module.exports = (common, options) => {
8080
await ipfs.files.write(src1, [], {
8181
create: true
8282
})
83+
8384
await expect(ipfs.files.cp(src1, `${parent}/child`)).to.eventually.be.rejectedWith(Error)
8485
.that.has.property('message').that.matches(/"identity"/)
8586
})

Diff for: packages/interface-ipfs-core/src/files/touch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = (common, options) => {
3333
})
3434

3535
const stat2 = await ipfs.files.stat(testPath)
36-
expect(stat2).to.have.nested.deep.property('mtime', expectedMtime)
36+
expect(stat2).to.have.deep.nested.property('mtime', expectedMtime)
3737
}
3838

3939
before(async () => { ipfs = (await common.spawn()).api })

Diff for: packages/interface-ipfs-core/src/get.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const last = require('it-last')
1212
const map = require('it-map')
1313
const { getDescribe, getIt, expect } = require('./utils/mocha')
1414
const testTimeout = require('./utils/test-timeout')
15-
const importer = require('ipfs-unixfs-importer')
15+
const { importer } = require('ipfs-unixfs-importer')
1616

1717
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
1818
/**

Diff for: packages/interface-ipfs-core/src/object/get.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const dagPB = require('ipld-dag-pb')
55
const DAGNode = dagPB.DAGNode
66
const { nanoid } = require('nanoid')
77
const { getDescribe, getIt, expect } = require('../utils/mocha')
8-
const UnixFs = require('ipfs-unixfs')
8+
const { UnixFS } = require('ipfs-unixfs')
99
const randomBytes = require('iso-random-stream/src/random')
1010
const { asDAGLink } = require('./utils')
1111
const testTimeout = require('../utils/test-timeout')
@@ -147,7 +147,7 @@ module.exports = (common, options) => {
147147
})
148148

149149
const node = await ipfs.object.get(result.cid)
150-
const meta = UnixFs.unmarshal(node.Data)
150+
const meta = UnixFS.unmarshal(node.Data)
151151

152152
expect(meta.fileSize()).to.equal(data.length)
153153
})

Diff for: packages/interface-ipfs-core/src/refs-local.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
const { fixtures } = require('./utils')
55
const { getDescribe, getIt, expect } = require('./utils/mocha')
66
const all = require('it-all')
7-
const importer = require('ipfs-unixfs-importer')
7+
const { importer } = require('ipfs-unixfs-importer')
88
const drain = require('it-drain')
99
const testTimeout = require('./utils/test-timeout')
1010
const CID = require('cids')

Diff for: packages/interface-ipfs-core/src/refs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const dagPB = require('ipld-dag-pb')
1212
const DAGNode = dagPB.DAGNode
1313
const DAGLink = dagPB.DAGLink
1414

15-
const UnixFS = require('ipfs-unixfs')
15+
const { UnixFS } = require('ipfs-unixfs')
1616

1717
/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
1818
/**

Diff for: packages/interface-ipfs-core/src/utils/is-shard-at-path.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
const UnixFS = require('ipfs-unixfs')
3+
const { UnixFS } = require('ipfs-unixfs')
44

55
module.exports = async (path, ipfs) => {
66
const stats = await ipfs.files.stat(path)

Diff for: packages/ipfs-cli/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@
3232
"cid-tool": "^1.0.0",
3333
"cids": "^1.1.5",
3434
"debug": "^4.1.1",
35-
"err-code": "^2.0.3",
35+
"err-code": "^3.0.1",
3636
"execa": "^5.0.0",
3737
"get-folder-size": "^2.0.1",
3838
"ipfs-core": "^0.5.4",
3939
"ipfs-core-utils": "^0.7.2",
4040
"ipfs-daemon": "^0.5.4",
4141
"ipfs-http-client": "^49.0.4",
42-
"ipfs-repo": "^8.0.0",
42+
"ipfs-repo": "^9.0.0",
4343
"ipfs-utils": "^6.0.1",
44-
"ipld-dag-cbor": "^0.17.0",
45-
"ipld-dag-pb": "^0.20.0",
44+
"ipld-dag-cbor": "^0.18.0",
45+
"ipld-dag-pb": "^0.22.0",
4646
"it-all": "^1.0.4",
4747
"it-concat": "^1.0.1",
4848
"it-first": "^1.0.4",

Diff for: packages/ipfs-cli/tsconfig.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "../../node_modules/aegir/src/config/tsconfig.aegir.json",
33
"compilerOptions": {
4-
"outDir": "dist"
4+
"outDir": "dist",
5+
"importsNotUsedAsValues": "preserve"
56
},
67
"include": [
78
"src",

Diff for: packages/ipfs-client/tsconfig.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "../../node_modules/aegir/src/config/tsconfig.aegir.json",
33
"compilerOptions": {
4-
"outDir": "dist"
4+
"outDir": "dist",
5+
"importsNotUsedAsValues": "preserve"
56
},
7+
"include": [
8+
"src",
9+
"package.json"
10+
],
611
"references": [
712
{
813
"path": "../ipfs-http-client"
914
},
1015
{
1116
"path": "../ipfs-grpc-client"
1217
}
13-
],
14-
"include": [
15-
"src",
16-
"package.json"
1718
]
1819
}

Diff for: packages/ipfs-core-types/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.3.1",
44
"description": "IPFS interface definitions used by implementations for API compatibility.",
55
"leadMaintainer": "Alex Potsides <alex@achingbrain.net>",
6-
"types": "src/index.ts",
6+
"types": "src/index.d.ts",
77
"homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/interface-ipfs-core#readme",
88
"bugs": "https://github.com/ipfs/js-ipfs/issues",
99
"scripts": {
@@ -30,6 +30,7 @@
3030
"dependencies": {
3131
"cids": "^1.1.5",
3232
"multiaddr": "^8.0.0",
33+
"multibase": "^4.0.2",
3334
"peer-id": "^0.14.1"
3435
},
3536
"devDependencies": {

0 commit comments

Comments
 (0)