import type { Service } from 'ts-node' ; let registerer = null ; const interopRequireDefault = ( obj ) : { default : any ; } => obj && obj . __esModule ? obj : { default : obj } ; internal export const loadTSConfig = ( configPath ) => { try { registerer ||= require ( 'ts-node' ) . register ( ) as Service ; } catch ( e ) { if ( e . code === 'MODULE_NOT_FOUND' ) { throw new Error ( `'ts-node' is required for TypeScript configuration files. Make sure it is installed\nError: ${ e . message }` ) ; } throw e ; } registerer . enabled ( true ) ; const configObject = interopRequireDefault ( require ( configPath ) ) . default ; registerer . enabled ( false ) ; return configObject ; } ; export const loadConfig = ( configPath ) => { if ( configPath . endsWith ( '.ts' ) ) { return loadTSConfig ( configPath ) ; } return require ( configPath ) ; } ;