Skip to content

Commit

Permalink
deps!: update multiformats to 10.x.x and all @ipld/* modules
Browse files Browse the repository at this point in the history
Also updates uint8arrays

BREAKING CHANGE: CIDs returned are instances from `[email protected]` and not `[email protected]`
  • Loading branch information
achingbrain committed Oct 19, 2022
1 parent a5b9cad commit 0f1d37d
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 39 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"release": "lerna exec --concurrency 1 -- semantic-release -e semantic-release-monorepo"
},
"dependencies": {
"lerna": "^5.0.0"
"lerna": "^6.0.1"
},
"workspaces": [
"packages/*"
Expand Down
22 changes: 11 additions & 11 deletions packages/ipfs-unixfs-exporter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,21 @@
"release": "aegir release"
},
"dependencies": {
"@ipld/dag-cbor": "^7.0.2",
"@ipld/dag-pb": "^2.0.2",
"@multiformats/murmur3": "^1.0.3",
"@ipld/dag-cbor": "^8.0.0",
"@ipld/dag-pb": "^3.0.0",
"@multiformats/murmur3": "^2.0.0",
"err-code": "^3.0.1",
"hamt-sharding": "^3.0.0",
"interface-blockstore": "^3.0.0",
"ipfs-unixfs": "^7.0.0",
"it-last": "^1.0.5",
"it-parallel": "^2.0.1",
"it-last": "^2.0.0",
"it-map": "^2.0.0",
"it-parallel": "^3.0.0",
"it-pipe": "^2.0.4",
"it-pushable": "^3.1.0",
"it-map": "^1.0.6",
"multiformats": "^10.0.0",
"p-queue": "^7.3.0",
"multiformats": "^9.4.2",
"uint8arrays": "^3.0.0"
"uint8arrays": "^4.0.2"
},
"devDependencies": {
"@types/sinon": "^10.0.0",
Expand All @@ -175,9 +175,9 @@
"crypto-browserify": "^3.12.0",
"delay": "^5.0.0",
"ipfs-unixfs-importer": "^10.0.0",
"it-all": "^1.0.5",
"it-buffer-stream": "^2.0.0",
"it-first": "^1.0.6",
"it-all": "^2.0.0",
"it-buffer-stream": "^3.0.0",
"it-first": "^2.0.0",
"merge-options": "^3.0.4",
"native-abort-controller": "^1.0.3",
"sinon": "^14.0.0"
Expand Down
20 changes: 10 additions & 10 deletions packages/ipfs-unixfs-importer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,27 +151,27 @@
"release": "aegir release"
},
"dependencies": {
"@ipld/dag-pb": "^2.0.2",
"@multiformats/murmur3": "^1.0.3",
"bl": "^5.0.0",
"@ipld/dag-pb": "^3.0.0",
"@multiformats/murmur3": "^2.0.0",
"err-code": "^3.0.1",
"hamt-sharding": "^3.0.0",
"interface-blockstore": "^3.0.0",
"ipfs-unixfs": "^7.0.0",
"it-all": "^1.0.5",
"it-batch": "^1.0.8",
"it-first": "^1.0.6",
"it-parallel-batch": "^1.0.9",
"it-all": "^2.0.0",
"it-batch": "^2.0.0",
"it-first": "^2.0.0",
"it-parallel-batch": "^2.0.0",
"merge-options": "^3.0.4",
"multiformats": "^9.4.2",
"multiformats": "^10.0.0",
"rabin-wasm": "^0.1.4",
"uint8arrays": "^3.0.0"
"uint8arraylist": "^2.3.3",
"uint8arrays": "^4.0.2"
},
"devDependencies": {
"aegir": "^37.5.0",
"assert": "^2.0.0",
"blockstore-core": "^2.0.1",
"it-buffer-stream": "^2.0.0",
"it-buffer-stream": "^3.0.0",
"wherearewe": "^2.0.1"
},
"browser": {
Expand Down
21 changes: 10 additions & 11 deletions packages/ipfs-unixfs-importer/src/chunker/fixed-size.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
// @ts-ignore
import BufferList from 'bl/BufferList.js'
import { Uint8ArrayList } from 'uint8arraylist'

/**
* @type {import('../types').Chunker}
*/
async function * fixedSizeChunker (source, options) {
let bl = new BufferList()
let list = new Uint8ArrayList()
let currentLength = 0
let emitted = false
const maxChunkSize = options.maxChunkSize

for await (const buffer of source) {
bl.append(buffer)
list.append(buffer)

currentLength += buffer.length

while (currentLength >= maxChunkSize) {
yield bl.slice(0, maxChunkSize)
yield list.slice(0, maxChunkSize)
emitted = true

// throw away consumed bytes
if (maxChunkSize === bl.length) {
bl = new BufferList()
if (maxChunkSize === list.length) {
list = new Uint8ArrayList()
currentLength = 0
} else {
const newBl = new BufferList()
newBl.append(bl.shallowSlice(maxChunkSize))
bl = newBl
const newBl = new Uint8ArrayList()
newBl.append(list.sublist(maxChunkSize))
list = newBl

// update our offset
currentLength -= maxChunkSize
Expand All @@ -36,7 +35,7 @@ async function * fixedSizeChunker (source, options) {

if (!emitted || currentLength) {
// return any remaining bytes or an empty buffer
yield bl.slice(0, currentLength)
yield list.subarray(0, currentLength)
}
}

Expand Down
7 changes: 3 additions & 4 deletions packages/ipfs-unixfs-importer/src/chunker/rabin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// @ts-ignore
import BufferList from 'bl/BufferList.js'
import { Uint8ArrayList } from 'uint8arraylist'
// @ts-ignore
import { create } from 'rabin-wasm'
import errcode from 'err-code'
Expand Down Expand Up @@ -65,7 +64,7 @@ export default rabinChunker
*/
async function * rabin (source, options) {
const r = await create(options.bits, options.min, options.max, options.window)
const buffers = new BufferList()
const buffers = new Uint8ArrayList()

for await (const chunk of source) {
buffers.append(chunk)
Expand All @@ -82,6 +81,6 @@ async function * rabin (source, options) {
}

if (buffers.length) {
yield buffers.slice(0)
yield buffers.subarray(0)
}
}
2 changes: 1 addition & 1 deletion packages/ipfs-unixfs-importer/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { UnixFS, Mtime } from 'ipfs-unixfs'
import type { CID, CIDVersion } from 'multiformats/cid'
import type { CID, Version as CIDVersion } from 'multiformats/cid'
import type { MultihashHasher } from 'multiformats/hashes/interface'
import type { BlockCodec } from 'multiformats/codecs/interface'
import type { Blockstore } from 'interface-blockstore'
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-unixfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
"devDependencies": {
"aegir": "^37.5.0",
"protobufjs-cli": "^1.0.0",
"uint8arrays": "^3.0.0"
"uint8arrays": "^4.0.2"
},
"browser": {
"fs": false
Expand Down

0 comments on commit 0f1d37d

Please sign in to comment.