import * as path from "path" ; function isTypescript ( ) { if ( process . env . ACTIONHERO_TYPESCRIPT_MODE ?. length > 0 ) { return process . env . ACTIONHERO_TYPESCRIPT_MODE . toLowerCase ( ) === "true" ? true : false ; } const extension = path . extname ( __filename ) ; if ( extension === ".ts" ) return true ; for ( const arg of process . argv ) { if ( arg . match ( /.+\.ts$/ ) ) return true ; } if ( process . env . TS_JEST ) return true ; const lastArg = process . execArgv [ process . execArgv . length - 1 ] ; if ( lastArg && path . parse ( lastArg ) . name . indexOf ( "ts-node" ) >= 0 ) { return true ; } try { /**
         * Are we running in typescript at the moment?
         * see https://github.com/TypeStrong/ts-node/pull/858 for more details
         */ if ( process [ Symbol . for ( "ts-node.register.instance" ) ] ) return true ; } catch ( error ) { console . error ( error ) ; return false ; } return false ; } export let typescript = isTypescript ( ) ; export const recalculateIsTypescript = ( ) => ( typescript = isTypescript ( ) ) ;