From 65b29c2fc2316b319cdc617c5d4e08a98b595773 Mon Sep 17 00:00:00 2001 From: Heri Sim Date: Thu, 14 Jun 2018 15:19:39 +0800 Subject: [PATCH 1/3] Optional Require of LevelDB-related deps --- lib/index-server.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/index-server.js b/lib/index-server.js index 725c6baa..a9bfe27a 100644 --- a/lib/index-server.js +++ b/lib/index-server.js @@ -1,11 +1,17 @@ Object.defineProperty(exports, "__esModule", { value: true }); global._fs = require("fs"); global._path = require("path"); -global._levelup = require("levelup"); -global._leveldown = require("leveldown"); +try { + global._levelup = require("levelup"); +} catch (err) {} +try { + global._leveldown = require("leveldown"); +} catch (err) {} +try { + global._Int64BE = require("int64-buffer").Uint64BE; +} catch (err) {} global._crypto = require("crypto"); -global._Int64BE = require("int64-buffer").Uint64BE; var index_1 = require("./index"); exports.NanoSQLInstance = index_1.NanoSQLInstance; exports.nSQL = index_1.nSQL; -//# sourceMappingURL=index-server.js.map \ No newline at end of file +//# sourceMappingURL=index-server.js.map From 2b4f6aba548a1b22f9f9f197ff659ffa3429402f Mon Sep 17 00:00:00 2001 From: Heri Sim Date: Thu, 14 Jun 2018 16:16:31 +0800 Subject: [PATCH 2/3] Update index-server.ts --- src/index-server.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/index-server.ts b/src/index-server.ts index 38ada962..96c05080 100644 --- a/src/index-server.ts +++ b/src/index-server.ts @@ -1,10 +1,16 @@ declare var global: any; global._fs = require("fs"); global._path = require("path"); -global._levelup = require("levelup"); -global._leveldown = require("leveldown"); global._crypto = require("crypto"); -global._Int64BE = require("int64-buffer").Uint64BE; +try { + global._levelup = require("levelup"); +catch () {} +try { + global._leveldown = require("leveldown"); +catch () {} +try { + global._Int64BE = require("int64-buffer").Uint64BE; +catch () {} import { ActionOrView, @@ -27,4 +33,4 @@ import { NanoSQLInstance, DBConnect, nSQL - }; \ No newline at end of file + }; From cc56cbeac2c3c3ef0aec145713bbaf9aae61ded0 Mon Sep 17 00:00:00 2001 From: Heri Sim Date: Thu, 14 Jun 2018 16:17:26 +0800 Subject: [PATCH 3/3] Update index-server.js --- lib/index-server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index-server.js b/lib/index-server.js index a9bfe27a..28827538 100644 --- a/lib/index-server.js +++ b/lib/index-server.js @@ -1,6 +1,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); global._fs = require("fs"); global._path = require("path"); +global._crypto = require("crypto"); try { global._levelup = require("levelup"); } catch (err) {} @@ -10,7 +11,6 @@ try { try { global._Int64BE = require("int64-buffer").Uint64BE; } catch (err) {} -global._crypto = require("crypto"); var index_1 = require("./index"); exports.NanoSQLInstance = index_1.NanoSQLInstance; exports.nSQL = index_1.nSQL;