Files
klz-cables.com/.pnpm-store/v10/files/88/0b745407ef1fb46436fafb5cc33c80b10f6199fa4b3cf4204330e0421fea8ebae7a528aeb43178e3f865153a63ed0408ce05f99ee199f97cf16c5b8554a73f
Marc Mintel 5397309103
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
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

49 lines
1.3 KiB
Plaintext

import ModulePatch from '@apm-js-collab/tracing-hooks';
import { GLOBAL_OBJ, debug } from '@sentry/core';
import * as moduleModule from 'module';
import { supportsEsmLoaderHooks } from '../utils/detection.js';
let instrumentationConfigs;
/**
* Add an instrumentation config to be used by the injection loader.
*/
function addInstrumentationConfig(config) {
if (!supportsEsmLoaderHooks()) {
return;
}
if (!instrumentationConfigs) {
instrumentationConfigs = [];
}
instrumentationConfigs.push(config);
GLOBAL_OBJ._sentryInjectLoaderHookRegister = () => {
if (GLOBAL_OBJ._sentryInjectLoaderHookRegistered) {
return;
}
GLOBAL_OBJ._sentryInjectLoaderHookRegistered = true;
const instrumentations = instrumentationConfigs || [];
// Patch require to support CJS modules
const requirePatch = new ModulePatch({ instrumentations });
requirePatch.patch();
// Add ESM loader to support ESM modules
try {
// @ts-expect-error register is available in these versions
moduleModule.register('@apm-js-collab/tracing-hooks/hook.mjs', import.meta.url, {
data: { instrumentations },
});
} catch (error) {
debug.warn("Failed to register '@apm-js-collab/tracing-hooks' hook", error);
}
};
}
export { addInstrumentationConfig };
//# sourceMappingURL=injectLoader.js.map