simplify setup by emiting index.js in ESM style from napi

This commit is contained in:
Nikita Sivukhin
2025-08-08 00:47:37 +04:00
parent b8f2ff293b
commit dd347fb3e3
10 changed files with 28 additions and 63 deletions

View File

@@ -3,8 +3,9 @@
// @ts-nocheck
/* auto-generated by NAPI-RS */
const { createRequire } = require('node:module')
require = createRequire(__filename)
import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)
const __dirname = new URL('.', import.meta.url).pathname
const { readFileSync } = require('node:fs')
let nativeBinding = null
@@ -392,6 +393,6 @@ if (!nativeBinding) {
throw new Error(`Failed to load native binding`)
}
module.exports = nativeBinding
module.exports.Database = nativeBinding.Database
module.exports.Statement = nativeBinding.Statement
const { Database, Statement } = nativeBinding
export { Database }
export { Statement }