use context detection to run the repl if script used as main or export functions if imported