import * as config from "./config" ; import * as Sentry from "@sentry/node" ; import { PlasmicLoaderConfig } from "./types" ; export async function setUser ( email ) { if ( ! config . sentryDsn ) { return ; } Sentry . configureScope ( ( scope ) => { scope . setUser ( { email } ) ; } ) ; } export async function initSentry ( options ) { if ( ! config . sentryDsn ) { return ; } Sentry . init ( { dsn : config . sentryDsn , defaultIntegrations : false , } ) ; Sentry . configureScope ( ( scope ) => { scope . setExtra ( "loaderVersion" , config . packageJson . version ) ; scope . setExtra ( "nodeVersion" , process . version ) ; scope . setExtra ( "projects" , options . projects ) ; scope . setExtra ( "config" , JSON . stringify ( options ) ) ; } ) ; } export async function captureException ( err ) { if ( ! config . sentryDsn ) { return ; } Sentry . captureException ( err ) ; return Sentry . close ( 2000 ) ; }