@react-native-windows/telemetry
Advanced tools
Comparing version 0.0.0-canary.75 to 0.0.0-canary.76
@@ -7,2 +7,3 @@ /** | ||
export { Telemetry, TelemetryOptions, CommandStartInfo, CommandEndInfo, } from './telemetry'; | ||
export { deviceArchitecture, nodeArchitecture } from './utils/basePropUtils'; | ||
export { CodedError, CodedErrorType, CodedErrors } from './utils/errorUtils'; | ||
@@ -9,0 +10,0 @@ export { yargsOptionsToOptions, commanderNameToOptionName, commanderOptionsToOptions, optionsToArgs, OptionSanitizer, YargsOptionsType, CommanderOptionsType, } from './utils/optionUtils'; |
@@ -8,5 +8,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getVersionOfNpmPackage = exports.getProjectFileFromConfig = exports.configToProjectInfo = exports.optionsToArgs = exports.commanderOptionsToOptions = exports.commanderNameToOptionName = exports.yargsOptionsToOptions = exports.CodedErrors = exports.CodedError = exports.Telemetry = void 0; | ||
exports.getVersionOfNpmPackage = exports.getProjectFileFromConfig = exports.configToProjectInfo = exports.optionsToArgs = exports.commanderOptionsToOptions = exports.commanderNameToOptionName = exports.yargsOptionsToOptions = exports.CodedErrors = exports.CodedError = exports.nodeArchitecture = exports.deviceArchitecture = exports.Telemetry = void 0; | ||
var telemetry_1 = require("./telemetry"); | ||
Object.defineProperty(exports, "Telemetry", { enumerable: true, get: function () { return telemetry_1.Telemetry; } }); | ||
var basePropUtils_1 = require("./utils/basePropUtils"); | ||
Object.defineProperty(exports, "deviceArchitecture", { enumerable: true, get: function () { return basePropUtils_1.deviceArchitecture; } }); | ||
Object.defineProperty(exports, "nodeArchitecture", { enumerable: true, get: function () { return basePropUtils_1.nodeArchitecture; } }); | ||
var errorUtils_1 = require("./utils/errorUtils"); | ||
@@ -13,0 +16,0 @@ Object.defineProperty(exports, "CodedError", { enumerable: true, get: function () { return errorUtils_1.CodedError; } }); |
@@ -137,2 +137,4 @@ "use strict"; | ||
basePropUtils.deviceArchitecture(); | ||
Telemetry.client.commonProperties.nodeArchitecture = | ||
basePropUtils.nodeArchitecture(); | ||
Telemetry.client.commonProperties.devicePlatform = | ||
@@ -139,0 +141,0 @@ basePropUtils.devicePlatform(); |
@@ -48,2 +48,8 @@ "use strict"; | ||
}); | ||
test('nodeArchitecture() is valid', () => { | ||
const value = basePropUtils.nodeArchitecture(); | ||
expect(value).toBeDefined(); | ||
expect(value).not.toBe(''); | ||
expect(value).not.toBeNull(); | ||
}); | ||
test('devicePlatform() is valid', () => { | ||
@@ -50,0 +56,0 @@ const value = basePropUtils.devicePlatform(); |
@@ -12,3 +12,3 @@ /** | ||
/** | ||
* Gets the device architecture, like x64/arm64. | ||
* Gets the device architecture, like x86/x64/arm64. | ||
* @returns The device architecture. | ||
@@ -18,2 +18,7 @@ */ | ||
/** | ||
* Gets the node architecture, like x86/x64/arm64. | ||
* @returns The node architecture. | ||
*/ | ||
export declare function nodeArchitecture(): string; | ||
/** | ||
* Gets the device platform, like darwin/linux/win32. | ||
@@ -20,0 +25,0 @@ * @returns The device platform. |
@@ -11,3 +11,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSessionId = exports.isCliTest = exports.isMsftInternal = exports.ciType = exports.isCI = exports.captureCI = exports.sampleRate = exports.deviceDiskFreeSpace = exports.deviceTotalMemory = exports.deviceNumCPUs = exports.deviceLocale = exports.devicePlatform = exports.deviceArchitecture = exports.deviceId = void 0; | ||
exports.getSessionId = exports.isCliTest = exports.isMsftInternal = exports.ciType = exports.isCI = exports.captureCI = exports.sampleRate = exports.deviceDiskFreeSpace = exports.deviceTotalMemory = exports.deviceNumCPUs = exports.deviceLocale = exports.devicePlatform = exports.nodeArchitecture = exports.deviceArchitecture = exports.deviceId = void 0; | ||
const child_process_1 = require("child_process"); | ||
@@ -26,3 +26,8 @@ const os_1 = require("os"); | ||
try { | ||
const output = (0, child_process_1.execSync)(`${process.env.windir}\\System32\\reg.exe query ${DeviceIdRegPath} /v ${DeviceIdRegKey}`).toString(); | ||
let regCommand = `${process.env.windir}\\System32\\reg.exe query ${DeviceIdRegPath} /v ${DeviceIdRegKey}`; | ||
if (deviceArchitecture() === 'x64') { | ||
// Ensure we query the correct registry | ||
regCommand += ' /reg:64'; | ||
} | ||
const output = (0, child_process_1.execSync)(regCommand).toString(); | ||
const result = output.match(/\{([0-9A-Fa-f-]{36})\}/); | ||
@@ -38,10 +43,23 @@ if (result && result.length > 1) { | ||
/** | ||
* Gets the device architecture, like x64/arm64. | ||
* Gets the device architecture, like x86/x64/arm64. | ||
* @returns The device architecture. | ||
*/ | ||
function deviceArchitecture() { | ||
return (0, os_1.arch)(); | ||
const nodeArch = nodeArchitecture(); | ||
// Check if we're running x86 node on x64 hardware | ||
if (nodeArch === 'x86' && process.env.PROCESSOR_ARCHITEW6432 === 'AMD64') { | ||
return 'x64'; | ||
} | ||
return nodeArch; | ||
} | ||
exports.deviceArchitecture = deviceArchitecture; | ||
/** | ||
* Gets the node architecture, like x86/x64/arm64. | ||
* @returns The node architecture. | ||
*/ | ||
function nodeArchitecture() { | ||
return process.arch === 'ia32' ? 'x86' : process.arch; | ||
} | ||
exports.nodeArchitecture = nodeArchitecture; | ||
/** | ||
* Gets the device platform, like darwin/linux/win32. | ||
@@ -48,0 +66,0 @@ * @returns The device platform. |
{ | ||
"name": "@react-native-windows/telemetry", | ||
"version": "0.0.0-canary.75", | ||
"version": "0.0.0-canary.76", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "lib-commonjs/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
278114
2824
26