napi.node.base 1.2.9 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// 只考虑到64位系统
|
|
2
1
|
const process = require('process')
|
|
3
|
-
|
|
4
|
-
const
|
|
2
|
+
// 识别环境+位数,拼接对应模块路径
|
|
3
|
+
const env = typeof nw !== 'undefined' ? 'nw.js' : (process.versions.electron ? 'electron' : 'node')
|
|
4
|
+
const nodePath = `./win32-${process.arch}/${env === 'nw.js' ? 'napi.nwjs.base.node' : 'napi.node.base.node'}`
|
|
5
5
|
|
|
6
6
|
try {
|
|
7
|
-
|
|
8
|
-
module.exports
|
|
7
|
+
const mod = require(nodePath)
|
|
8
|
+
module.exports = { ...mod, env: `${env}:${process.arch}` }
|
|
9
9
|
} catch (e) {
|
|
10
|
-
module.exports
|
|
10
|
+
module.exports = { env: `${env}:${process.arch}: ${e.message}`, error: e }
|
|
11
11
|
}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|