native-machine-id 0.1.0 → 0.1.2
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/dist/bin/machine-id.js +0 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -8
- package/dist/index.js.map +1 -1
- package/package.json +12 -10
- package/dist/debug.d.ts +0 -6
- package/dist/debug.d.ts.map +0 -1
- package/dist/debug.js +0 -44
- package/dist/debug.js.map +0 -1
package/dist/bin/machine-id.js
CHANGED
|
File without changes
|
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":"AA2CA,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
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
|
|
3
|
+
exports.getMachineId = getMachineId;
|
|
4
|
+
exports.getMachineIdSync = getMachineIdSync;
|
|
8
5
|
const crypto_1 = require("crypto");
|
|
9
6
|
const util_1 = require("util");
|
|
10
|
-
const binding = (
|
|
7
|
+
const binding = (() => {
|
|
8
|
+
try {
|
|
9
|
+
return require('../build/Release/native_machine_id.node');
|
|
10
|
+
}
|
|
11
|
+
catch (outerError) {
|
|
12
|
+
try {
|
|
13
|
+
return require('../build/Debug/native_machine_id.node');
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
throw outerError;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
})();
|
|
11
20
|
function getMachineIdFromBindingSync() {
|
|
12
21
|
try {
|
|
13
22
|
return binding.getMachineIdSync() || undefined;
|
|
@@ -32,7 +41,6 @@ async function getMachineId({ raw = false, } = {}) {
|
|
|
32
41
|
}
|
|
33
42
|
return (0, crypto_1.createHash)('sha256').update(machineId).digest('hex');
|
|
34
43
|
}
|
|
35
|
-
exports.getMachineId = getMachineId;
|
|
36
44
|
function getMachineIdSync({ raw = false } = {}) {
|
|
37
45
|
const machineId = getMachineIdFromBindingSync();
|
|
38
46
|
if (!machineId || raw === true) {
|
|
@@ -40,5 +48,4 @@ function getMachineIdSync({ raw = false } = {}) {
|
|
|
40
48
|
}
|
|
41
49
|
return (0, crypto_1.createHash)('sha256').update(machineId).digest('hex');
|
|
42
50
|
}
|
|
43
|
-
exports.getMachineIdSync = getMachineIdSync;
|
|
44
51
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAoDA,oCAUC;AAMD,4CAUC;AA9ED,mCAAoC;AACpC,+BAAiC;AAOjC,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE;IACpB,IAAI,CAAC;QAEH,OAAO,OAAO,CAAC,yCAAyC,CAA0B,CAAC;IACrF,CAAC;IAAC,OAAO,UAAU,EAAE,CAAC;QACpB,IAAI,CAAC;YAEH,OAAO,OAAO,CAAC,uCAAuC,CAA0B,CAAC;QACnF,CAAC;Q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
|
|
1
1
|
{
|
|
2
2
|
"name": "native-machine-id",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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",
|
|
@@ -20,14 +20,15 @@
|
|
|
20
20
|
"author": "Compass Team <compass@mongodb.com>",
|
|
21
21
|
"gypfile": true,
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"bindings": "^1.5.0",
|
|
24
23
|
"node-addon-api": "^8.0.0"
|
|
25
24
|
},
|
|
26
25
|
"license": "Apache-2.0",
|
|
27
26
|
"exports": {
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
".": {
|
|
28
|
+
"require": "./dist/index.js",
|
|
29
|
+
"import": "./dist/.esm-wrapper.mjs",
|
|
30
|
+
"types": "./dist/index.d.ts"
|
|
31
|
+
}
|
|
31
32
|
},
|
|
32
33
|
"homepage": "https://github.com/mongodb-js/devtools-shared",
|
|
33
34
|
"repository": {
|
|
@@ -51,15 +52,15 @@
|
|
|
51
52
|
"@mongodb-js/tsconfig-devtools": "^1.0.3",
|
|
52
53
|
"@types/chai": "^4.2.21",
|
|
53
54
|
"@types/mocha": "^9.1.1",
|
|
54
|
-
"@types/sinon-chai": "^3.2.5",
|
|
55
55
|
"@types/node": "^17.0.35",
|
|
56
|
+
"@types/sinon-chai": "^3.2.5",
|
|
57
|
+
"chai": "^4.5.0",
|
|
56
58
|
"eslint": "^7.25.0",
|
|
57
59
|
"gen-esm-wrapper": "^1.1.1",
|
|
58
60
|
"mocha": "^8.4.0",
|
|
59
|
-
"chai": "^4.5.0",
|
|
60
61
|
"node-machine-id": "^1.1.12",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
62
|
+
"ts-node": "^10.9.2",
|
|
63
|
+
"typescript": "^5.0.4"
|
|
63
64
|
},
|
|
64
65
|
"keywords": [
|
|
65
66
|
"machine id",
|
|
@@ -78,5 +79,6 @@
|
|
|
78
79
|
"native",
|
|
79
80
|
"telemetry",
|
|
80
81
|
"telemetry id"
|
|
81
|
-
]
|
|
82
|
+
],
|
|
83
|
+
"gitHead": "de981133ae507a4b249e24755dd35065d414c237"
|
|
82
84
|
}
|
package/dist/debug.d.ts
DELETED
package/dist/debug.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
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
|
package/dist/debug.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,kBAAkB,EAAE,OAAO,SAAS,CAAC,kBAAkB,KAAK,WAAW;CAC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