From 57c8a4cb1dd3e2ef976e585f7cb8328bfa88e0d0 Mon Sep 17 00:00:00 2001 From: Mitra Ardron Date: Sun, 8 Sep 2019 15:06:57 +1000 Subject: [PATCH] Remove Gun dependency to consumer of library --- TransportGUN.js | 4 +++- TransportIPFS.js | 11 ++--------- package.json | 4 ---- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/TransportGUN.js b/TransportGUN.js index c67027e..64a4e02 100644 --- a/TransportGUN.js +++ b/TransportGUN.js @@ -5,6 +5,8 @@ See https://github.com/internetarchive/dweb-mirror/issues/43 for meta issue */ const Url = require('url'); process.env.GUN_ENV = "false"; + +/* This should be done in the caller (see dweb-archive/archive.html for example) const Gun = require('gun/gun.js'); // gun/gun is the minimized version // Raw Gun has almost nothing in it, it needs at least the following to work properly. require('gun/lib/path.js'); // So that .path works @@ -22,7 +24,7 @@ require('gun/lib/radix.js'); // loaded by store but required for webpack require('gun/lib/radisk.js'); // loaded by store but required for webpack require('gun/lib/store.js'); require('gun/lib/rindexed.js'); - +*/ const debuggun = require('debug')('dweb-transports:gun'); const canonicaljson = require('@stratumn/canonicaljson'); diff --git a/TransportIPFS.js b/TransportIPFS.js index 2f2dadf..1177e11 100644 --- a/TransportIPFS.js +++ b/TransportIPFS.js @@ -9,24 +9,17 @@ const httptools = require('./httptools'); // Expose some of the httptools so tha const debug = require('debug')('dweb-transports:ipfs'); // IPFS components -//TODO-SPLIT remove this import depend on archive.html or node to pre-load let IPFS; //TODO-SPLIT move this line lower when fix structure +//TODO-SPLIT remove this import depend on archive.html or node to pre-load //IPFS = require('ipfs'); //TODO-SPLIT remove this import depend on archive.html or node to pre-load const ipfsAPI = require('ipfs-http-client'); -//TODO-SPLIT looks like can get this from Ipfs.CID +//We now get this from IPFS.CID //const CID = require('cids'); -//TODO-SPLIT unclear why need unixfs - only appears to be used in test_ipfs.js -//const unixFs = require('ipfs-unixfs'); // Library packages other than IPFS const Url = require('url'); const stream = require('readable-stream'); // Needed for the pullthrough - this is NOT Ipfs streams -// Alternative to through - as used in WebTorrent - -// Utility packages (ours) And one-liners -//No longer reqd: const promisify = require('promisify-es6'); -//const makepromises = require('./utils/makepromises'); // Replaced by direct call to promisify // Other Dweb modules const errors = require('./Errors'); // Standard Dweb Errors diff --git a/package.json b/package.json index 2bec473..40e97f8 100644 --- a/package.json +++ b/package.json @@ -12,12 +12,8 @@ }, "dependencies": { "@stratumn/canonicaljson": "^1.0.3", - "cids": "^0.7.1", "debug": "^4.1.1", - "gun": "^0.2019.726", - "ipfs": "^0.35.0", "ipfs-http-client": "^33.1.1", - "ipfs-unixfs": "^0.1.16", "node-fetch": "^2.3.0", "readable-stream": "^3.3.0", "webpack": "^4.29.3",