build(node): migrate from CommonJS to ESM modules

This commit is contained in:
link2xt
2023-11-10 01:41:07 +00:00
parent 94dc65c1a2
commit b607f12b0e
20 changed files with 89 additions and 75 deletions

View File

@@ -1,9 +1,13 @@
import { join } from 'path'
import * as url from 'url'
/**
* bindings are not typed yet.
* if the available function names are required they can be found inside of `../src/module.c`
*/
export const bindings: any = require('node-gyp-build')(join(__dirname, '../'))
import build from 'node-gyp-build'
export const bindings: any = build(
join(url.fileURLToPath(new URL('.', import.meta.url)), '../')
)
export default bindings