Skip to content

Commit

Permalink
Fix dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
andreialecu committed Nov 2, 2020
1 parent 79df553 commit ee0e3bf
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 34 deletions.
1 change: 0 additions & 1 deletion docs/guide/installation-guide.txt
Expand Up @@ -21,7 +21,6 @@ Troubleshooting
The MongoDB driver depends on several other packages, including:

* `bson <https://www.npmjs.com/package/bson>`_
* `require_optional <https://www.npmjs.com/package/require_optional>`_
* `safe-buffer <https://www.npmjs.com/package/safe-buffer>`_
* `saslprep <https://www.npmjs.com/package/saslprep>`_

Expand Down
6 changes: 2 additions & 4 deletions lib/core/connection/utils.js
@@ -1,7 +1,5 @@
'use strict';

const require_optional = require('require_optional');

function debugOptions(debugFields, options) {
var finaloptions = {};
debugFields.forEach(function(n) {
Expand All @@ -16,7 +14,7 @@ function retrieveBSON() {
BSON.native = false;

try {
var optionalBSON = require_optional('bson-ext');
var optionalBSON = require('bson-ext');
if (optionalBSON) {
optionalBSON.native = true;
return optionalBSON;
Expand All @@ -37,7 +35,7 @@ function noSnappyWarning() {
function retrieveSnappy() {
var snappy = null;
try {
snappy = require_optional('snappy');
snappy = require('snappy');
} catch (error) {} // eslint-disable-line
if (!snappy) {
snappy = {
Expand Down
3 changes: 1 addition & 2 deletions lib/core/index.js
@@ -1,12 +1,11 @@
'use strict';

let BSON = require('bson');
const require_optional = require('require_optional');
const EJSON = require('./utils').retrieveEJSON();

try {
// Attempt to grab the native BSON parser
const BSONNative = require_optional('bson-ext');
const BSONNative = require('bson-ext');
// If we got the native parser, use it instead of the
// Javascript one
if (BSONNative) {
Expand Down
5 changes: 2 additions & 3 deletions lib/core/utils.js
@@ -1,7 +1,6 @@
'use strict';
const os = require('os');
const crypto = require('crypto');
const requireOptional = require('require_optional');

/**
* Generate a UUIDv4
Expand All @@ -27,7 +26,7 @@ function retrieveKerberos() {
let kerberos;

try {
kerberos = requireOptional('kerberos');
kerberos = require('kerberos');
} catch (err) {
if (err.code === 'MODULE_NOT_FOUND') {
throw new Error('The `kerberos` module was not found. Please install it and try again.');
Expand All @@ -48,7 +47,7 @@ const noEJSONError = function() {
function retrieveEJSON() {
let EJSON = null;
try {
EJSON = requireOptional('mongodb-extjson');
EJSON = require('mongodb-extjson');
} catch (error) {} // eslint-disable-line
if (!EJSON) {
EJSON = {
Expand Down
21 changes: 0 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 23 additions & 3 deletions package.json
Expand Up @@ -16,18 +16,38 @@
"driver",
"official"
],
"peerOptionalDependencies": {
"peerDependencies": {
"kerberos": "^1.1.0",
"mongodb-client-encryption": "^1.0.0",
"mongodb-extjson": "^2.1.2",
"snappy": "^6.3.4",
"bson-ext": "^2.0.0"
"bson-ext": "^2.0.0",
"aws4": "^1.10.1"
},
"peerDependenciesMeta": {
"kerberos": {
"optional": true
},
"mongodb-client-encryption": {
"optional": true
},
"mongodb-extjson": {
"optional": true
},
"snappy": {
"optional": true
},
"bson-ext": {
"optional": true
},
"aws4": {
"optional": true
}
},
"dependencies": {
"bl": "^2.2.1",
"bson": "^1.1.4",
"denque": "^1.4.1",
"require_optional": "^1.0.1",
"safe-buffer": "^5.1.2"
},
"devDependencies": {
Expand Down

0 comments on commit ee0e3bf

Please sign in to comment.