Skip to content

Commit

Permalink
remove bindings dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Dec 2, 2024
1 parent 0936bf0 commit 79cb304
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/docker/Dockerfile.glibc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN apt-get -qq update && apt-get -qq install -y python3 build-essential && ldd
RUN npm run install:libmongocrypt

ARG RUN_TEST
RUN [ -n "$RUN_TEST" ] && npm run test || echo 'skipping testing!'
RUN if [ -n "$RUN_TEST" ]; then npm test ; else echo "skipping tests" ; fi

FROM scratch

Expand Down
27 changes: 0 additions & 27 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"gypfile": true,
"mongodb:libmongocrypt": "1.11.0",
"dependencies": {
"bindings": "^1.5.0",
"node-addon-api": "^4.3.0",
"prebuild-install": "^7.1.2"
},
Expand Down Expand Up @@ -97,4 +96,4 @@
"moduleResolution": "node"
}
}
}
}
15 changes: 11 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { cryptoCallbacks } from './crypto_callbacks';
export { cryptoCallbacks };

import bindings = require('bindings');
const mc: MongoCryptBindings = bindings('mongocrypt');
function load() {
try {
return require('../build/Release/mongocrypt.node');
} catch {
return require('../build/Debug/mongocrypt.node');
}
}

const mc: MongoCryptBindings = load();

/**
* The value returned by the native bindings
Expand Down Expand Up @@ -54,7 +61,7 @@ type MongoCryptConstructorOptions = {
};

export interface MongoCryptConstructor {
new (options: MongoCryptConstructorOptions): MongoCrypt;
new(options: MongoCryptConstructorOptions): MongoCrypt;

Check failure on line 64 in src/index.ts

View workflow job for this annotation

GitHub Actions / typescript

Insert `·`
libmongocryptVersion: string;
}

Expand Down Expand Up @@ -116,6 +123,6 @@ export const MongoCrypt: MongoCryptConstructor = class MongoCrypt extends mc.Mon

/** exported for testing only. */
interface MongoCryptContextCtor {
new (): MongoCryptContext;
new(): MongoCryptContext;

Check failure on line 126 in src/index.ts

View workflow job for this annotation

GitHub Actions / typescript

Insert `·`
}
export const MongoCryptContextCtor: MongoCryptContextCtor = mc.MongoCryptContextCtor;

0 comments on commit 79cb304

Please sign in to comment.