import fs from 'fs' ; import path from 'path' ; import { isDev } from './node-env' ; param appDirectory param name returns export const isDepExists = ( appDirectory , name ) : boolean => { const json = require ( path . resolve ( appDirectory , './package.json' ) ) ; const { dependencies = { } , devDependencies = { } } = json ; return ( dependencies . hasOwnProperty ( name ) || devDependencies . hasOwnProperty ( name ) ) ; } ; param root returns export const isTypescript = ( root ) : boolean => fs . existsSync ( path . resolve ( root , './tsconfig.json' ) ) ; param o returns export const isEmpty = ( o ) => Object . entries ( o ) . length === 0 && o . constructor === Object ; param config returns export const isSSR = ( config ) : boolean => { const { server } = config ; if ( server ?. ssr ) { return true ; } if ( server ?. ssrByEntries && ! isEmpty ( server . ssrByEntries ) ) { for ( const name of Object . keys ( server . ssrByEntries ) ) { if ( server . ssrByEntries [ name ] ) { return true ; } } } return false ; } ; export const isUseSSRBundle = ( config ) : boolean => { const { output } = config ; if ( output ?. ssg ) { return true ; } return isSSR ( config ) ; } ; export const isFastRefresh = ( ) => isDev ( ) && process . env . FAST_REFRESH !== 'false' ; export * from './node-env' ; export * from './platform' ; export * from './type' ;