rs-diff/index.js

16 lines
550 B
JavaScript
Raw Normal View History

2020-08-25 08:47:12 +00:00
const path = require('path')
2020-08-14 08:11:58 +00:00
const { loadBinding } = require('@node-rs/helper')
try {
// __dirname means load native addon from current dir
// 'index' means native addon name is `index`
// the value of this two arguments was decided by `build` script in `package.json`
2020-09-11 04:24:57 +00:00
module.exports = loadBinding(path.join(__dirname, 'index', '@mtfos/rs-diff')
2020-08-14 08:11:58 +00:00
} catch (e) {
try {
module.exports = require(`@swc-node/core-${platform()}`)
} catch (e) {
throw new TypeError('Not compatible with your platform. Error message: ' + e.message)
}
}