UNPKG

hud-sdk

Version:

Hud's Node SDK

94 lines (85 loc) 3.44 kB
import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "node:module"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // EXPORTS __webpack_require__.d(__webpack_exports__, { init: () => (/* reexport */ core_namespaceObject.init) }); ;// external "node:module" const external_node_module_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:module"); ;// external "../cjs/globalstate" const globalstate_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("../cjs/globalstate"); ;// external "../cjs/instrument" const instrument_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("../cjs/instrument"); ;// external "../cjs/lib" const lib_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("../cjs/lib"); ;// external "../cjs/core" const core_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("../cjs/core"); ;// ./src/entries/on_import.mts function onImport() { if (globalThis.hudRanOnImport) { lib_namespaceObject.app_logger.warn("Already ran onImport!"); return; } globalThis.hudRanOnImport = true; try { const hudHookPort = (0,globalstate_namespaceObject.hookMessageChannel)(); (0,external_node_module_namespaceObject.register)("./loader.mjs", { parentURL: import.meta.url, data: { port: hudHookPort }, transferList: [hudHookPort], }); } catch (e) { lib_namespaceObject.app_logger.error("Something went wrong in onImport", { msg: e instanceof Error ? e.message : undefined, stack: e instanceof Error ? e.stack : undefined, }); } } function main() { try { (0,lib_namespaceObject.updateUserConfigFromFile)(); (0,lib_namespaceObject.updateUserConfigFromEnv)(); const shouldRunHudResult = (0,lib_namespaceObject.shouldRunHud)(); if (!shouldRunHudResult.shouldRun) { if (shouldRunHudResult.error !== null) { lib_namespaceObject.customer_logger.log(shouldRunHudResult.error); } return; } (0,instrument_namespaceObject.registerHook)(); if (!globalThis.hudRuningInsideLambda) { onImport(); lib_namespaceObject.app_logger.debug("onImport done"); } } catch { // Intentionally empty } } main(); const __webpack_exports__init = __webpack_exports__.init; export { __webpack_exports__init as init }; //# sourceMappingURL=on_import.mjs.map