Remove Gun dependency to consumer of library

This commit is contained in:
Mitra Ardron 2019-09-08 15:06:57 +10:00
parent 4addbc3120
commit 57c8a4cb1d
3 changed files with 5 additions and 14 deletions

View File

@ -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');

View File

@ -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

View File

@ -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",