hud-sdk
Version:
Hud's Node SDK
2 lines • 2.14 kB
JavaScript
import{createRequire as e}from"node:module";var t={180:function(e,t,o){var r=this&&this.__createBinding||(Object.create?function(e,t,o,r){void 0===r&&(r=o);var n=Object.getOwnPropertyDescriptor(t,o);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,r,n)}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]}),n=this&&this.__exportStar||function(e,t){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(t,o)||r(t,e,o)};Object.defineProperty(t,"__esModule",{value:!0}),n(o(898),t)},898:t=>{t.exports=e(import.meta.url)("../cjs/internal")}},o={},r=function e(r){var n=o[r];if(void 0!==n)return n.exports;var i=o[r]={exports:{}};return t[r].call(i.exports,i,i.exports,e),i.exports}(180);const n=e(import.meta.url)("url");let i,s,a=!1;const c=(0,r.isSupportedNative)(),u=async({port:e})=>{i=e,s=(0,r.shouldSupportSourceMap)(),setTimeout((()=>{try{r.instrument_logger.info("Getting tsconfig from esm loader"),(0,r.getUserTsNodeConfig)(!1)}catch(e){r.instrument_logger.error("Error getting tsconfig from esm loader",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}}),r.hudConfig.tsNodeConfigTimeout)},m=async(e,t,o)=>{const u=await o(e,t);if(!c||!u.source)return u;try{if(u.format===r.Format.esm){const t=(0,n.fileURLToPath)(e);r.instrument_logger.debug("Loading module",{modulePath:t});const o=(0,r.patch)(u.source?.toString(),t,r.Format.esm,i);if(u.source=o.code,s&&o.map){const e=(0,r.combineSourceMaps)(o.map,t);e&&i.postMessage({key:"HudRetrieveFileCache",filename:t,content:e})}}else if(u.format===r.Format.moduleTypescript||u.format===r.Format.commonjsTypescript){a||(a=!0,r.instrument_logger.warn("Tried to load at least one unsupported typescript format"));const t=(0,n.fileURLToPath)(e);r.instrument_logger.debug("Loading unsupported format",{format:u.format,modulePath:t})}}catch(e){r.instrument_logger.error("Something went wrong in load hook",{msg:e instanceof Error?e.message:void 0,stack:e instanceof Error?e.stack:void 0})}return u};export{u as initialize,m as load};
//# sourceMappingURL=loader.mjs.map