Skip to content

Commit

Permalink
fix: remove node globals (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias authored Apr 24, 2020
1 parent b0217cc commit 5414412
Show file tree
Hide file tree
Showing 25 changed files with 47 additions and 25 deletions.
13 changes: 7 additions & 6 deletions packages/ipfs-unixfs-exporter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,24 @@
"homepage": "https://github.com/ipfs/js-ipfs-unixfs#readme",
"devDependencies": {
"abort-controller": "^3.0.0",
"aegir": "^21.3.0",
"async-iterator-all": "^1.0.0",
"async-iterator-buffer-stream": "^1.0.0",
"async-iterator-first": "^1.0.0",
"aegir": "^21.9.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"detect-node": "^2.0.4",
"dirty-chai": "^2.0.1",
"ipfs-unixfs-importer": "^2.0.0",
"ipld": "^0.25.0",
"ipld": "^0.26.1",
"ipld-dag-pb": "^0.18.0",
"ipld-in-memory": "^3.0.0",
"ipld-in-memory": "^4.0.0",
"it-all": "^1.0.1",
"it-buffer-stream": "^1.0.2",
"it-first": "^1.0.1",
"multicodec": "^1.0.0",
"nyc": "^15.0.0",
"sinon": "^9.0.1"
},
"dependencies": {
"buffer": "^5.6.0",
"cids": "^0.8.0",
"err-code": "^2.0.0",
"hamt-sharding": "^1.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/ipfs-unixfs-exporter/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { Buffer } = require('buffer')
const errCode = require('err-code')
const CID = require('cids')
const resolve = require('./resolvers')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { Buffer } = require('buffer')
const extractDataFromBlock = require('../../../utils/extract-data-from-block')
const validateOffsetAndLength = require('../../../utils/validate-offset-and-length')
const UnixFS = require('ipfs-unixfs')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict'
const { Buffer } = require('buffer')

module.exports = function extractDataFromBlock (block, blockStart, requestedStart, requestedEnd) {
const blockLength = block.length
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { Buffer } = require('buffer')
const Bucket = require('hamt-sharding/src/bucket')
const multihashing = require('multihashing-async')

Expand Down
5 changes: 3 additions & 2 deletions packages/ipfs-unixfs-exporter/test/exporter-sharded.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-env mocha */
'use strict'

const { Buffer } = require('buffer')
const chai = require('chai')
chai.use(require('dirty-chai'))
const expect = chai.expect
Expand All @@ -9,9 +10,9 @@ const inMemory = require('ipld-in-memory')
const UnixFS = require('ipfs-unixfs')
const mh = require('multihashing-async').multihash
const mc = require('multicodec')
const all = require('async-iterator-all')
const all = require('it-all')
const last = require('it-last')
const randomBytes = require('async-iterator-buffer-stream')
const randomBytes = require('it-buffer-stream')
const exporter = require('../src')
const importer = require('ipfs-unixfs-importer')
const {
Expand Down
5 changes: 3 additions & 2 deletions packages/ipfs-unixfs-exporter/test/exporter-subtree.spec.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
/* eslint-env mocha */
'use strict'

const { Buffer } = require('buffer')
const chai = require('chai')
chai.use(require('dirty-chai'))
const expect = chai.expect
const IPLD = require('ipld')
const inMemory = require('ipld-in-memory')
const importer = require('ipfs-unixfs-importer')
const mc = require('multicodec')
const all = require('async-iterator-all')
const all = require('it-all')
const last = require('it-last')
const randomBytes = require('async-iterator-buffer-stream')
const blockApi = require('./helpers/block')
const randomBytes = require('it-buffer-stream')

const ONE_MEG = Math.pow(1024, 2)

Expand Down
7 changes: 4 additions & 3 deletions packages/ipfs-unixfs-exporter/test/exporter.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-env mocha */
'use strict'

const { Buffer } = require('buffer')
const chai = require('chai')
chai.use(require('dirty-chai'))
chai.use(require('chai-as-promised'))
Expand All @@ -17,10 +18,10 @@ const mh = require('multihashing-async').multihash
const mc = require('multicodec')
const exporter = require('../src')
const importer = require('ipfs-unixfs-importer')
const all = require('async-iterator-all')
const all = require('it-all')
const last = require('it-last')
const first = require('async-iterator-first')
const randomBytes = require('async-iterator-buffer-stream')
const first = require('it-first')
const randomBytes = require('it-buffer-stream')
const AbortController = require('abort-controller')
const blockApi = require('./helpers/block')

Expand Down
1 change: 1 addition & 0 deletions packages/ipfs-unixfs-exporter/test/helpers/create-shard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { Buffer } = require('buffer')
const importer = require('ipfs-unixfs-importer')

const SHARD_SPLIT_THRESHOLD = 10
Expand Down
11 changes: 6 additions & 5 deletions packages/ipfs-unixfs-importer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,24 @@
},
"homepage": "https://github.com/ipfs/js-ipfs-unixfs#readme",
"devDependencies": {
"aegir": "^21.3.0",
"aegir": "^21.9.0",
"chai": "^4.2.0",
"cids": "^0.8.0",
"deep-extend": "^0.6.0",
"detect-node": "^2.0.4",
"dirty-chai": "^2.0.1",
"ipfs-unixfs-exporter": "^2.0.0",
"ipld": "^0.25.0",
"ipld-in-memory": "^3.0.0",
"it-buffer-stream": "^1.0.0",
"ipld": "^0.26.1",
"ipld-in-memory": "^4.0.0",
"it-buffer-stream": "^1.0.2",
"it-last": "^1.0.1",
"merge-options": "^2.0.0",
"multicodec": "^1.0.0",
"nyc": "^15.0.0",
"sinon": "^9.0.1"
},
"dependencies": {
"bl": "^4.0.0",
"buffer": "^5.6.0",
"err-code": "^2.0.0",
"hamt-sharding": "^1.0.0",
"ipfs-unixfs": "^1.0.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'

const errCode = require('err-code')
const { Buffer } = require('buffer')

// make sure the content only emits buffer-a-likes
async function * validateChunks (source) {
Expand Down
1 change: 1 addition & 0 deletions packages/ipfs-unixfs-importer/src/dir-sharded.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const {
DAGLink,
DAGNode
} = require('ipld-dag-pb')
const { Buffer } = require('buffer')
const UnixFS = require('ipfs-unixfs')
const multihashing = require('multihashing-async')
const Dir = require('./dir')
Expand Down
1 change: 1 addition & 0 deletions packages/ipfs-unixfs-importer/test/benchmark.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-env mocha */
'use strict'

const { Buffer } = require('buffer')
const importer = require('../src')

const IPLD = require('ipld')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-env mocha */
'use strict'

const { Buffer } = require('buffer')
const importer = require('../src')
const exporter = require('ipfs-unixfs-exporter')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-env mocha */
'use strict'

const { Buffer } = require('buffer')
const chai = require('chai')
chai.use(require('dirty-chai'))
const expect = chai.expect
Expand Down
1 change: 1 addition & 0 deletions packages/ipfs-unixfs-importer/test/builder.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-env mocha */
'use strict'

const { Buffer } = require('buffer')
const chai = require('chai')
chai.use(require('dirty-chai'))
const expect = chai.expect
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-unixfs-importer/test/chunker-custom.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'use strict'

const importer = require('../src')

const { Buffer } = require('buffer')
const chai = require('chai')
chai.use(require('dirty-chai'))
const expect = chai.expect
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-env mocha */
'use strict'

const { Buffer } = require('buffer')
const chunker = require('../src/chunker/fixed-size')
const chai = require('chai')
chai.use(require('dirty-chai'))
Expand Down
1 change: 1 addition & 0 deletions packages/ipfs-unixfs-importer/test/chunker-rabin.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-env mocha */
'use strict'

const { Buffer } = require('buffer')
const chunker = require('../src/chunker/rabin')
const chai = require('chai')
chai.use(require('dirty-chai'))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

const { Buffer } = require('buffer')

module.exports = function (cid, ipld) {
async function * traverse (cid) {
const node = await ipld.get(cid)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'

const { Buffer } = require('buffer')
const REPEATABLE_CHUNK_SIZE = 300000

module.exports = function * (maxSize, seed) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { Buffer } = require('buffer')
module.exports = function * randomByteStream (seed) {
while (true) {
const r = Math.floor(random(seed) * 256)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-env mocha */
'use strict'

const { Buffer } = require('buffer')
const chai = require('chai')
chai.use(require('dirty-chai'))
const expect = chai.expect
Expand Down
6 changes: 3 additions & 3 deletions packages/ipfs-unixfs-importer/test/importer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

const importer = require('../src')
const exporter = require('ipfs-unixfs-exporter')

const extend = require('deep-extend')
const { Buffer } = require('buffer')
const extend = require('merge-options')
const chai = require('chai')
chai.use(require('dirty-chai'))
const expect = chai.expect
Expand Down Expand Up @@ -287,7 +287,7 @@ strategies.forEach((strategy) => {
})
}, strategyOverrides[strategy])

const expected = extend({}, defaultResults, strategies[strategy])
const expected = extend({}, defaultResults)

const expectFiles = (actualFiles, expectedFiles) => {
expect(actualFiles.length).to.equal(expectedFiles.length)
Expand Down
4 changes: 2 additions & 2 deletions packages/ipfs-unixfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
},
"homepage": "https://github.com/ipfs/js-ipfs-unixfs#readme",
"devDependencies": {
"aegir": "^21.3.0",
"aegir": "^21.9.0",
"chai": "^4.2.0",
"dirty-chai": "^2.0.1",
"nyc": "^15.0.0"
},
"dependencies": {
"err-code": "^2.0.0",
"protons": "^1.1.0"
"protons": "^1.0.2"
}
}

0 comments on commit 5414412

Please sign in to comment.