import { existsSync } from 'node:fs'; import { dirname, resolve, relative } from 'node:path'; const ENV_FALLBACK_OPTIONS_FN = "() => undefined"; const OPTIONS_IMPORT_IDENTIFIER = "__SENTRY_OPTIONS_CALLBACK__"; const INSTRUMENT_FILE_BASENAME = "instrument.server"; const INSTRUMENT_FILE_EXTENSIONS = ["ts", "mts", "js", "mjs", "cjs"]; function resolveInstrumentFile(entryFilePath) { const dir = dirname(entryFilePath); for (const ext of INSTRUMENT_FILE_EXTENSIONS) { const candidate = resolve(dir, `${INSTRUMENT_FILE_BASENAME}.${ext}`); if (existsSync(candidate)) return candidate; } return void 0; } function buildOptionsImport(entryFilePath, instrumentFilePath) { let relativePath = relative(dirname(entryFilePath), instrumentFilePath).replace(/\\/g, "/"); if (!relativePath.startsWith(".")) relativePath = `./${relativePath}`; return { optionsFn: OPTIONS_IMPORT_IDENTIFIER, importStmt: `import ${OPTIONS_IMPORT_IDENTIFIER} from '${relativePath}'; ` }; } export { ENV_FALLBACK_OPTIONS_FN, buildOptionsImport, resolveInstrumentFile }; //# sourceMappingURL=instrumentFile.js.map