@logtape/windows-eventlog
Version:
Windows Event Log sink for LogTape
30 lines (28 loc) • 1.06 kB
JavaScript
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
const require_types = require('./types.cjs');
const node_process = require_rolldown_runtime.__toESM(require("node:process"));
//#region platform.ts
/**
* Validates that the current platform is Windows.
* Throws a WindowsPlatformError if running on a non-Windows platform.
*
* @throws {WindowsPlatformError} When running on non-Windows platforms
* @since 1.0.0
*/
function validateWindowsPlatform() {
const platform = getPlatform();
if (platform !== "windows" && platform !== "win32") throw new require_types.WindowsPlatformError(platform);
}
/**
* Gets the current platform in a cross-runtime compatible way.
*
* @returns The platform identifier
* @since 1.0.0
*/
function getPlatform() {
if (typeof Deno !== "undefined" && Deno.build?.os) return Deno.build.os;
if (typeof node_process.default !== "undefined" && node_process.default.platform) return node_process.default.platform;
return "unknown";
}
//#endregion
exports.validateWindowsPlatform = validateWindowsPlatform;