UNPKG

appium-webdriveragent

Version:
31 lines 1.36 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.BOOTSTRAP_PATH = void 0; exports.getWDAUpgradeTimestamp = getWDAUpgradeTimestamp; const support_1 = require("@appium/support"); const node_path_1 = __importDefault(require("node:path")); const node_url_1 = require("node:url"); // Get current filename - works in both CommonJS and ESM const currentFilename = typeof __filename !== 'undefined' ? __filename : (0, node_url_1.fileURLToPath)(new Function('return import.meta.url')()); const moduleRoot = support_1.node.getModuleRootSync('appium-webdriveragent', currentFilename); if (!moduleRoot) { throw new Error('Cannot find the root folder of the appium-webdriveragent Node.js module'); } exports.BOOTSTRAP_PATH = moduleRoot; /** * Retrieves WDA upgrade timestamp. The manifest only gets modified on package upgrade. */ async function getWDAUpgradeTimestamp() { const packageManifest = node_path_1.default.resolve(exports.BOOTSTRAP_PATH, 'package.json'); if (!(await support_1.fs.exists(packageManifest))) { return null; } const { mtime } = await support_1.fs.stat(packageManifest); return mtime.getTime(); } //# sourceMappingURL=module.js.map