import { RegSuitCore } from "reg-suit-core" ; import { CliOptions } from "./cli-options" ; import packageUtil from "./package-util" ; let _coreInstanceForCache ; function getRegCore ( options , ignoreCache = false ) { const localCoreModuleId = options . noInstallCore ? null : packageUtil . checkInstalledLocalCore ( ) ; let core ; if ( ! ignoreCache && _coreInstanceForCache ) { return _coreInstanceForCache ; } if ( localCoreModuleId ) { const CoreFactory = require ( localCoreModuleId ) [ "RegSuitCore" ] as typeof RegSuitCore ; core = new CoreFactory ( { logLevel : options . logLevel , noEmit : options . noEmit , configFileName : options . configFileName , } ) ; } else { core = new RegSuitCore ( { logLevel : options . logLevel , noEmit : options . noEmit , configFileName : options . configFileName , } ) ; } _coreInstanceForCache = core ; return _coreInstanceForCache ; } export default getRegCore ;