Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/scripts/libmongocrypt.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import util from 'node:util';
import process from 'node:process';
import fs from 'node:fs/promises';
import fs, { readFile } from 'node:fs/promises';
import child_process from 'node:child_process';
import events from 'node:events';
import path from 'node:path';
Expand Down Expand Up @@ -189,9 +189,17 @@ async function buildBindings(args, pkg) {
await run('npm', ['run', 'prepare']);

if (process.platform === 'darwin' && process.arch === 'arm64') {
// @ts-ignore
const {
binary: {
napi_versions: [
napiVersion
]
}
} = JSON.parse(await readFile(resolveRoot('package.json'), 'utf-8'));
// The "arm64" build is actually a universal binary
const armTar = `mongodb-client-encryption-v${pkg.version}-napi-v4-darwin-arm64.tar.gz`;
const x64Tar = `mongodb-client-encryption-v${pkg.version}-napi-v4-darwin-x64.tar.gz`;
const armTar = `mongodb-client-encryption-v${pkg.version}-napi-v${napiVersion}-darwin-arm64.tar.gz`;
const x64Tar = `mongodb-client-encryption-v${pkg.version}-napi-v${napiVersion}-darwin-x64.tar.gz`;
await fs.copyFile(resolveRoot('prebuilds', armTar), resolveRoot('prebuilds', x64Tar));
}
}
Expand Down
8 changes: 1 addition & 7 deletions addon/mongocrypt.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
#ifndef NODE_MONGOCRYPT_H
#define NODE_MONGOCRYPT_H

// We generally only target N-API version 4, but the instance data
// feature is only available in N-API version 6. However, it is
// available in all Node.js versions that have N-API version 4
// as an experimental feature (that has not been changed since then).
#define NAPI_VERSION 6
#define NAPI_EXPERIMENTAL
#define NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT
#define NAPI_VERSION 9

#include <napi.h>

Expand Down
12 changes: 8 additions & 4 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"gypfile": true,
"mongodb:libmongocrypt": "1.15.1",
"dependencies": {
"node-addon-api": "^4.3.0",
"node-addon-api": "^8.5.0",
"prebuild-install": "^7.1.3"
},
"devDependencies": {
Expand Down Expand Up @@ -80,7 +80,7 @@
},
"binary": {
"napi_versions": [
4
9
]
},
"repository": {
Expand All @@ -96,4 +96,4 @@
"moduleResolution": "node"
}
}
}
}
4 changes: 1 addition & 3 deletions test/bundling/webpack/install_ce.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const { execSync } = require('node:child_process');
const { readFileSync } = require('node:fs');
const { resolve } = require('node:path');
Expand All @@ -19,6 +17,6 @@ console.log(`mongodb-client-encryption Version: ${ceVersion}`);

xtrace('npm pack --pack-destination test/bundling/webpack', { cwd: ceRoot });

xtrace(`npm install --no-save mongodb-client-encryption-${ceVersion}.tgz`);
xtrace(`npm install --ignore-scripts --no-save mongodb-client-encryption-${ceVersion}.tgz`);

console.log('mongodb-client-encryption installed!');