Dashboard › cli › Distillation
d518c84a-c3ef-456a-ba23-b8e5f46f8b8e["lore_tm_v1_fTLx_lcSlBq5yxo2uBtJ5XWW191MbMGgbjhOo2CD7XA","lore_tm_v1_KSmtMJxye4fcgLbs_lJr0Q9gebBalDWFAHbYb7zB3lk","lore_tm_v1_z3qA_GDf3RWzVqMWknX4d3tMDl7szQZTEbV8ib1mu3o","lore_tm_v1_i6x6BvU2NrDzf_9H8LvLPAQWEpPCREGyhPayhVnZSbA","lore_tm_v1_N5xmf6-65LTiSSzJj9iKAmDoD_WarnBtXGziemWUTHE","lore_tm_v1_0tqL-sYaoRgtJiGGI0cbe-3F6P2o44DbjU5KPTjrl88","lore_tm_v1_kua8tL25FXk8X7CD9BmQ9VZhQ3jwo0OqLLb0Vhnw_Xo"]
packages/cli/test/lib/dsn/detector.test.ts lines 316-345 defines the monorepo test “detects DSNs in monorepo package directories”: creates packages/frontend/.env with https://frontend@o111.ingest.sentry.io/111 and packages/backend/.env with https://backend@o222.ingest.sentry.io/222; expects detectAllDsns(testDir) to return exactly 2 DSNs, hasMultiple === true, and packagePath values packages/frontend and packages/backend.packages/cli/test/lib/dsn/detector.test.ts lines 347-370 defines the Turborepo-style apps test: creates apps/web/.env with https://web@o111.ingest.sentry.io/111 and apps/mobile/.env with https://mobile@o222.ingest.sentry.io/222; expects exactly 2 DSNs, hasMultiple === true, and packagePath values apps/web and apps/mobile.packages/cli/test/lib/dsn/detector.test.ts lines 373-449 tests getDsnSourceDescription(): an env DSN without sourcePath maps to SENTRY_DSN environment variable; an env DSN with sourcePath: "NEXT_PUBLIC_SENTRY_DSN" maps to NEXT_PUBLIC_SENTRY_DSN environment variable; env_file with .env.local maps to .env.local; code with src/instrumentation.ts maps to src/instrumentation.ts; and inferred maps to directory name inference.packages/cli/src/lib/dsn/detector.ts lines 148-231 implements detectAllDsns() cache/full-scan behavior: cached results return allDsns, first item as primary, hasMultiple based on length, and the cached fingerprint; cache misses deduplicate via seenRawDsns, scan code first with scanCodeForDsns(projectRoot), scan all root/monorepo env files second with detectFromAllEnvFiles(projectRoot), and check detectFromEnv() last.packages/cli/src/lib/dsn/detector.ts records code and env-file source mtimes, code directory mtimes, and the floored projectRoot mtimeMs; it computes createDsnFingerprint(allDsns) and calls setCachedDetection(projectRoot, { fingerprint, allDsns, sourceMtimes, dirMtimes, rootDirMtime }). Detection priority is code > env_file > env_var, while multiple DSNs are explicitly valid for monorepos.packages/cli/src/lib/dsn/env-file.ts defines ENV_FILES in this exact priority order: 1. .env.local, 2. .env.development.local, 3. .env.production.local, 4. .env, 5. .env.development, 6. .env.production.packages/cli/src/lib/dsn/env-file.ts builds ENV_DSN_PATTERN from FRAMEWORK_ENV_PREFIXES and recognizes canonical SENTRY_DSN plus NEXT_PUBLIC_SENTRY_DSN, REACT_APP_SENTRY_DSN, VITE_SENTRY_DSN, EXPO_PUBLIC_SENTRY_DSN, and NUXT_PUBLIC_SENTRY_DSN; extractDsnFromEnvContent() skips blank/comment lines and supports unquoted, single-quoted, double-quoted, and trailing-comment forms.detectFromEnvFiles(cwd) scans only the given directory with scanSpecificFiles(cwd, [...ENV_FILES], { stopOnFirst: true, ... }); detectFromAllEnvFiles(cwd) scans all 6 root env-file names with stopOnFirst: false, then calls detectFromMonorepoEnvFiles(cwd) for common MONOREPO_ROOTS. Telemetry reports ENV_FILES.length * (1 + packagesScanned) as dsn.env_files_checked.detectFromMonorepoEnvFiles() uses opendir() for each join(cwd, monorepoRoot) and wraps both opening and iteration in one try/catch because Bun may defer the missing-directory error until iteration.v4.1.10 both passed all 21 tests: first run took 9.46s (transform 6.34s, setup 296ms, import 7.52s, tests 847ms); second took 3.96s (transform 2.48s, setup 88ms, import 3.11s, tests 552ms). Each run reported Test Files 1 passed (1) and Tests 21 passed (21). was removed in Vitest 4; previous poolOptions must now be top-level options, per https://vitest.dev/guide/migration#pool-rework.