Files
wickra/bindings/node/index.js
T

31 lines
925 B
JavaScript
Raw Normal View History

/* eslint-disable */
/* prettier-ignore */
// This loader is generated by `napi build --platform` at publish time. For
// editable development just `require` the local debug binary that napi places
// at the package root.
const { join } = require('node:path');
const { existsSync } = require('node:fs');
const { platform, arch } = process;
function loadNative() {
// Try precompiled per-platform binary first (published wheels do this).
const candidates = [
`./wickra.${platform}-${arch}.node`,
`./wickra.${platform}-${arch}-musl.node`,
'./wickra.node',
];
for (const c of candidates) {
const p = join(__dirname, c);
if (existsSync(p)) {
return require(p);
}
}
throw new Error(
`Wickra: no precompiled binary found for ${platform}-${arch}. ` +
'Build from source with `napi build --release` or install a platform-specific package.'
);
}
module.exports = loadNative();