Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
1 line
2.4 KiB
Plaintext
1 line
2.4 KiB
Plaintext
{"version":3,"file":"injectLoader.js","sources":["../../../src/sdk/injectLoader.ts"],"sourcesContent":["import type { InstrumentationConfig } from '@apm-js-collab/code-transformer';\nimport ModulePatch from '@apm-js-collab/tracing-hooks';\nimport { debug, GLOBAL_OBJ } from '@sentry/core';\nimport * as moduleModule from 'module';\nimport { supportsEsmLoaderHooks } from '../utils/detection';\n\nlet instrumentationConfigs: InstrumentationConfig[] | undefined;\n\n/**\n * Add an instrumentation config to be used by the injection loader.\n */\nexport function addInstrumentationConfig(config: InstrumentationConfig): void {\n if (!supportsEsmLoaderHooks()) {\n return;\n }\n\n if (!instrumentationConfigs) {\n instrumentationConfigs = [];\n }\n\n instrumentationConfigs.push(config);\n\n GLOBAL_OBJ._sentryInjectLoaderHookRegister = () => {\n if (GLOBAL_OBJ._sentryInjectLoaderHookRegistered) {\n return;\n }\n\n GLOBAL_OBJ._sentryInjectLoaderHookRegistered = true;\n\n const instrumentations = instrumentationConfigs || [];\n\n // Patch require to support CJS modules\n const requirePatch = new ModulePatch({ instrumentations });\n requirePatch.patch();\n\n // Add ESM loader to support ESM modules\n try {\n // @ts-expect-error register is available in these versions\n moduleModule.register('@apm-js-collab/tracing-hooks/hook.mjs', import.meta.url, {\n data: { instrumentations },\n });\n } catch (error) {\n debug.warn(\"Failed to register '@apm-js-collab/tracing-hooks' hook\", error);\n }\n };\n}\n"],"names":["supportsEsmLoaderHooks","GLOBAL_OBJ","ModulePatch","debug"],"mappings":";;;;;;;;AAMA,IAAI,sBAAsB;;AAE1B;AACA;AACA;AACO,SAAS,wBAAwB,CAAC,MAAM,EAA+B;AAC9E,EAAE,IAAI,CAACA,gCAAsB,EAAE,EAAE;AACjC,IAAI;AACJ,EAAE;;AAEF,EAAE,IAAI,CAAC,sBAAsB,EAAE;AAC/B,IAAI,sBAAA,GAAyB,EAAE;AAC/B,EAAE;;AAEF,EAAE,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC;;AAErC,EAAEC,eAAU,CAAC,+BAAA,GAAkC,MAAM;AACrD,IAAI,IAAIA,eAAU,CAAC,iCAAiC,EAAE;AACtD,MAAM;AACN,IAAI;;AAEJ,IAAIA,eAAU,CAAC,iCAAA,GAAoC,IAAI;;AAEvD,IAAI,MAAM,gBAAA,GAAmB,sBAAA,IAA0B,EAAE;;AAEzD;AACA,IAAI,MAAM,eAAe,IAAIC,mBAAW,CAAC,EAAE,gBAAA,EAAkB,CAAC;AAC9D,IAAI,YAAY,CAAC,KAAK,EAAE;;AAExB;AACA,IAAI,IAAI;AACR;AACA,MAAM,YAAY,CAAC,QAAQ,CAAC,uCAAuC,EAAE,qQAAe,EAAE;AACtF,QAAQ,IAAI,EAAE,EAAE,gBAAA,EAAkB;AAClC,OAAO,CAAC;AACR,IAAI,CAAA,CAAE,OAAO,KAAK,EAAE;AACpB,MAAMC,UAAK,CAAC,IAAI,CAAC,wDAAwD,EAAE,KAAK,CAAC;AACjF,IAAI;AACJ,EAAE,CAAC;AACH;;;;"} |