11import type { TelemetryEventRaw } from '@clerk/types' ;
2- import { dirname , join } from 'path' ;
32
43import { canUseKeyless } from '../utils/feature-flags' ;
54import { createClerkClientWithOptions } from './createClerkClient' ;
6- import { nodeFsOrThrow } from './fs/utils' ;
5+ import { nodeFsOrThrow , nodePathOrThrow } from './fs/utils' ;
76
87const EVENT_KEYLESS_ENV_DRIFT_DETECTED = 'KEYLESS_ENV_DRIFT_DETECTED' ;
98const EVENT_SAMPLING_RATE = 1 ; // 100% sampling rate
@@ -27,7 +26,8 @@ type EventKeylessEnvDriftPayload = {
2726 * @returns The absolute path to the telemetry flag file in the project's .clerk/.tmp directory
2827 */
2928function getTelemetryFlagFilePath ( ) : string {
30- return join ( process . cwd ( ) , TELEMETRY_FLAG_FILE ) ;
29+ const path = nodePathOrThrow ( ) ;
30+ return path . join ( process . cwd ( ) , TELEMETRY_FLAG_FILE ) ;
3131}
3232
3333/**
@@ -45,8 +45,9 @@ function tryMarkTelemetryEventAsFired(): boolean {
4545 try {
4646 if ( canUseKeyless ) {
4747 const { mkdirSync, writeFileSync } = nodeFsOrThrow ( ) ;
48+ const path = nodePathOrThrow ( ) ;
4849 const flagFilePath = getTelemetryFlagFilePath ( ) ;
49- const flagDirectory = dirname ( flagFilePath ) ;
50+ const flagDirectory = path . dirname ( flagFilePath ) ;
5051
5152 // Ensure the directory exists before attempting to write the file
5253 mkdirSync ( flagDirectory , { recursive : true } ) ;
0 commit comments