native-machine-id 0.0.12 → 0.1.0
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/binding.gyp +1 -1
- package/dist/debug.d.ts +6 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +44 -0
- package/dist/debug.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -23
- package/dist/index.js.map +1 -1
- package/package.json +10 -14
package/binding.gyp
CHANGED
package/dist/debug.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,SAAS,EAAE,GAAY,CAAC;AAY9B,QAAA,MAAM,UAAU;;;GAoBf,CAAC"}
|
package/dist/debug.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
console.log('Node.js version:', process.version);
|
|
3
|
+
console.log('Process type:', process.type || 'standard node');
|
|
4
|
+
console.log('Electron:', process.versions.electron || 'not running in Electron');
|
|
5
|
+
const globalAny = global;
|
|
6
|
+
console.log('BoxedNode features detected:', {
|
|
7
|
+
hasBoxednodeConfig: typeof globalAny.__boxednode_config !== 'undefined',
|
|
8
|
+
hasBoxednodeRequireMapper: typeof globalAny.__boxednode_require_mapper !== 'undefined',
|
|
9
|
+
hasOriginalRequire: typeof globalAny.__original_require !== 'undefined',
|
|
10
|
+
});
|
|
11
|
+
console.log('Module paths:', module.paths);
|
|
12
|
+
const approaches = [
|
|
13
|
+
{ name: 'Standard require', fn: () => require('native_machine_id.node') },
|
|
14
|
+
{ name: 'Bindings', fn: () => require('bindings')('native_machine_id') },
|
|
15
|
+
{
|
|
16
|
+
name: 'Relative path',
|
|
17
|
+
fn: () => require('../build/Release/native_machine_id.node'),
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'Dynamic path',
|
|
21
|
+
fn: () => require(require('path').join(__dirname, '..', 'build', 'Release', 'native_machine_id.node')),
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
for (const approach of approaches) {
|
|
25
|
+
try {
|
|
26
|
+
const result = approach.fn();
|
|
27
|
+
console.log(`✅ ${approach.name} succeeded:`, {
|
|
28
|
+
hasMachineIdSync: typeof result.getMachineIdSync === 'function',
|
|
29
|
+
hasMachineIdAsync: typeof result.getMachineIdAsync === 'function',
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.error(`❌ ${approach.name} failed:`, error.message);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const { getMachineIdSync } = require('../dist/index.js');
|
|
38
|
+
const id = getMachineIdSync();
|
|
39
|
+
console.log('✅ getMachineIdSync returned:', id ? `${id.substring(0, 8)}...` : 'undefined');
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.error('❌ getMachineIdSync failed:', error.message);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":";AAOA,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;AACjD,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,IAAI,IAAI,eAAe,CAAC,CAAC;AAC9D,OAAO,CAAC,GAAG,CACT,WAAW,EACX,OAAO,CAAC,QAAQ,CAAC,QAAQ,IAAI,yBAAyB,CACvD,CAAC;AAGF,MAAM,SAAS,GAAQ,MAAM,CAAC;AAC9B,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE;IAC1C,kBAAkB,EAAE,OAAO,SAAS,CAAC,kBAAkB,KAAK,WAAW;IACvE,yBAAyB,EACvB,OAAO,SAAS,CAAC,0BAA0B,KAAK,WAAW;IAC7D,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CAAC,kBAAkB,CAAC,CAAC;IACzD,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAC9B,OAAO,CAAC,GAAG,CACT,8BAA8B,EAC9B,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAC9C,CAAC;AACJ,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;AAC7D,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2BA,MAAM,MAAM,mBAAmB,GAAG;IAEhC,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAMF,wBAAsB,YAAY,CAAC,EACjC,GAAW,GACZ,GAAE,mBAAwB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAQxD;AAMD,wBAAgB,gBAAgB,CAAC,EAAE,GAAW,EAAE,GAAE,mBAAwB,GACtE,MAAM,GACN,SAAS,CAQZ"}
|
package/dist/index.js
CHANGED
|
@@ -3,32 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getMachineId =
|
|
7
|
-
exports.getMachineIdSync = getMachineIdSync;
|
|
6
|
+
exports.getMachineIdSync = exports.getMachineId = void 0;
|
|
8
7
|
const bindings_1 = __importDefault(require("bindings"));
|
|
9
8
|
const crypto_1 = require("crypto");
|
|
10
|
-
const path_1 = __importDefault(require("path"));
|
|
11
9
|
const util_1 = require("util");
|
|
12
|
-
const
|
|
13
|
-
const tries = [() => (0, bindings_1.default)('native_machine_id')];
|
|
14
|
-
for (const tryBinding of tries) {
|
|
15
|
-
try {
|
|
16
|
-
return tryBinding();
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
console.error(error);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
throw new Error('Unable to load native machine ID bindings. Please ensure the module is built correctly. Tried: ' +
|
|
23
|
-
JSON.stringify([
|
|
24
|
-
require.resolve('native_machine_id.node'),
|
|
25
|
-
path_1.default.resolve('../build/Release/native_machine_id.node'),
|
|
26
|
-
path_1.default.resolve('../build/Debug/native_machine_id.node'),
|
|
27
|
-
__dirname,
|
|
28
|
-
process.cwd(),
|
|
29
|
-
]));
|
|
30
|
-
};
|
|
31
|
-
const binding = getBindings();
|
|
10
|
+
const binding = (0, bindings_1.default)('native_machine_id');
|
|
32
11
|
function getMachineIdFromBindingSync() {
|
|
33
12
|
try {
|
|
34
13
|
return binding.getMachineIdSync() || undefined;
|
|
@@ -53,6 +32,7 @@ async function getMachineId({ raw = false, } = {}) {
|
|
|
53
32
|
}
|
|
54
33
|
return (0, crypto_1.createHash)('sha256').update(machineId).digest('hex');
|
|
55
34
|
}
|
|
35
|
+
exports.getMachineId = getMachineId;
|
|
56
36
|
function getMachineIdSync({ raw = false } = {}) {
|
|
57
37
|
const machineId = getMachineIdFromBindingSync();
|
|
58
38
|
if (!machineId || raw === true) {
|
|
@@ -60,4 +40,5 @@ function getMachineIdSync({ raw = false } = {}) {
|
|
|
60
40
|
}
|
|
61
41
|
return (0, crypto_1.createHash)('sha256').update(machineId).digest('hex');
|
|
62
42
|
}
|
|
43
|
+
exports.getMachineIdSync = getMachineIdSync;
|
|
63
44
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"m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AVD,4CAUC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "native-machine-id",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Native retrieval of a unique desktop machine ID without admin privileges or child processes. Faster and more reliable alternative to node-machine-id.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"compile": "tsc -p tsconfig.json && node-gyp rebuild && gen-esm-wrapper . ./dist/.esm-wrapper.mjs",
|
|
9
9
|
"bootstrap": "npm run compile",
|
|
10
10
|
"pretest": "npm run compile",
|
|
11
|
-
"install": "
|
|
11
|
+
"install": "node-gyp rebuild",
|
|
12
12
|
"test": "mocha",
|
|
13
13
|
"test-cov": "nyc -x \"**/*.spec.*\" --reporter=lcov --reporter=text --reporter=html npm run test",
|
|
14
14
|
"test-ci": "npm run test-cov",
|
|
@@ -21,16 +21,13 @@
|
|
|
21
21
|
"gypfile": true,
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"bindings": "^1.5.0",
|
|
24
|
-
"node-addon-api": "^
|
|
24
|
+
"node-addon-api": "^8.0.0"
|
|
25
25
|
},
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"exports": {
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"types": "./dist/index.d.ts"
|
|
32
|
-
},
|
|
33
|
-
"./package.json": "./package.json"
|
|
28
|
+
"require": "./dist/index.js",
|
|
29
|
+
"import": "./dist/.esm-wrapper.mjs",
|
|
30
|
+
"types": "./dist/index.d.ts"
|
|
34
31
|
},
|
|
35
32
|
"homepage": "https://github.com/mongodb-js/devtools-shared",
|
|
36
33
|
"repository": {
|
|
@@ -52,18 +49,17 @@
|
|
|
52
49
|
"@mongodb-js/mocha-config-devtools": "^1.0.5",
|
|
53
50
|
"@mongodb-js/prettier-config-devtools": "^1.0.2",
|
|
54
51
|
"@mongodb-js/tsconfig-devtools": "^1.0.3",
|
|
55
|
-
"@types/bindings": "^1.5.5",
|
|
56
52
|
"@types/chai": "^4.2.21",
|
|
57
53
|
"@types/mocha": "^9.1.1",
|
|
58
|
-
"@types/node": "^17.0.35",
|
|
59
54
|
"@types/sinon-chai": "^3.2.5",
|
|
60
|
-
"
|
|
55
|
+
"@types/node": "^17.0.35",
|
|
61
56
|
"eslint": "^7.25.0",
|
|
62
57
|
"gen-esm-wrapper": "^1.1.1",
|
|
63
58
|
"mocha": "^8.4.0",
|
|
59
|
+
"chai": "^4.5.0",
|
|
64
60
|
"node-machine-id": "^1.1.12",
|
|
65
|
-
"
|
|
66
|
-
"
|
|
61
|
+
"typescript": "^5.0.4",
|
|
62
|
+
"ts-node": "^10.9.2"
|
|
67
63
|
},
|
|
68
64
|
"keywords": [
|
|
69
65
|
"machine id",
|