Skip to content

Commit be138a9

Browse files
feat(NODE-7168)!: increase napi version to 9 (#93)
1 parent c46c1b9 commit be138a9

File tree

5 files changed

+24
-20
lines changed

5 files changed

+24
-20
lines changed

.github/scripts/libmongocrypt.mjs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import util from 'node:util';
44
import process from 'node:process';
5-
import fs from 'node:fs/promises';
5+
import fs, { readFile } from 'node:fs/promises';
66
import child_process from 'node:child_process';
77
import events from 'node:events';
88
import path from 'node:path';
@@ -189,9 +189,17 @@ async function buildBindings(args, pkg) {
189189
await run('npm', ['run', 'prepare']);
190190

191191
if (process.platform === 'darwin' && process.arch === 'arm64') {
192+
// @ts-ignore
193+
const {
194+
binary: {
195+
napi_versions: [
196+
napiVersion
197+
]
198+
}
199+
} = JSON.parse(await readFile(resolveRoot('package.json'), 'utf-8'));
192200
// The "arm64" build is actually a universal binary
193-
const armTar = `mongodb-client-encryption-v${pkg.version}-napi-v4-darwin-arm64.tar.gz`;
194-
const x64Tar = `mongodb-client-encryption-v${pkg.version}-napi-v4-darwin-x64.tar.gz`;
201+
const armTar = `mongodb-client-encryption-v${pkg.version}-napi-v${napiVersion}-darwin-arm64.tar.gz`;
202+
const x64Tar = `mongodb-client-encryption-v${pkg.version}-napi-v${napiVersion}-darwin-x64.tar.gz`;
195203
await fs.copyFile(resolveRoot('prebuilds', armTar), resolveRoot('prebuilds', x64Tar));
196204
}
197205
}

addon/mongocrypt.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
#ifndef NODE_MONGOCRYPT_H
22
#define NODE_MONGOCRYPT_H
33

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

126
#include <napi.h>
137

package-lock.json

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"gypfile": true,
3838
"mongodb:libmongocrypt": "1.15.1",
3939
"dependencies": {
40-
"node-addon-api": "^4.3.0",
40+
"node-addon-api": "^8.5.0",
4141
"prebuild-install": "^7.1.3"
4242
},
4343
"devDependencies": {
@@ -80,7 +80,7 @@
8080
},
8181
"binary": {
8282
"napi_versions": [
83-
4
83+
9
8484
]
8585
},
8686
"repository": {
@@ -96,4 +96,4 @@
9696
"moduleResolution": "node"
9797
}
9898
}
99-
}
99+
}

test/bundling/webpack/install_ce.cjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
const { execSync } = require('node:child_process');
42
const { readFileSync } = require('node:fs');
53
const { resolve } = require('node:path');
@@ -19,6 +17,6 @@ console.log(`mongodb-client-encryption Version: ${ceVersion}`);
1917

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

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

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

0 commit comments

Comments
 (0)