File tree Expand file tree Collapse file tree 2 files changed +27
-20
lines changed Expand file tree Collapse file tree 2 files changed +27
-20
lines changed Original file line number Diff line number Diff line change 11import { isPackageExists } from 'local-pkg'
22import { ensurePackages , interopDefault , toArray } from '../shared'
33import { GLOB_JS , GLOB_JSX , GLOB_TS , GLOB_TSX } from '../constants/glob'
4+ import { isUsingNext , isUsingRemix } from '../env'
45import type {
56 OptionsFiles ,
67 OptionsOverrides ,
@@ -10,13 +11,6 @@ import type {
1011
1112// react refresh
1213const ReactRefreshAllowConstantExportPackages = [ 'vite' ]
13- const RemixPackages = [
14- '@remix-run/node' ,
15- '@remix-run/react' ,
16- '@remix-run/serve' ,
17- '@remix-run/dev' ,
18- ]
19- const NextJsPackages = [ 'next' ]
2014
2115export async function react (
2216 options : OptionsTypeScriptWithTypes & OptionsOverrides & OptionsFiles = { } ,
@@ -45,8 +39,6 @@ export async function react(
4539 const isAllowConstantExport = ReactRefreshAllowConstantExportPackages . some (
4640 i => isPackageExists ( i ) ,
4741 )
48- const isUsingRemix = RemixPackages . some ( i => isPackageExists ( i ) )
49- const isUsingNext = NextJsPackages . some ( i => isPackageExists ( i ) )
5042
5143 const plugins = pluginReact . configs . all . plugins
5244
Original file line number Diff line number Diff line change @@ -9,14 +9,29 @@ export const isInEditor = !!(
99 && ! process . env . CI
1010)
1111export const hasTypeScript = isPackageExists ( 'typescript' )
12- // export const hasReact = isPackageExists('react') || isPackageExists('next')
13- export const hasVue
14- = isPackageExists ( 'vue' )
15- || isPackageExists ( 'nuxt' )
16- || isPackageExists ( 'vitepress' )
17- || isPackageExists ( '@slidev/cli' )
18- export const hasUnocss
19- = isPackageExists ( 'unocss' )
20- || isPackageExists ( '@unocss/webpack' )
21- || isPackageExists ( '@unocss/nuxt' )
22- export const hasTailwindCSS = isPackageExists ( 'tailwindcss' ) && ! hasUnocss
12+
13+ const VueJsPackages = [
14+ 'vue' ,
15+ 'nuxt' ,
16+ 'vitepress' ,
17+ '@slidev/cli' ,
18+ ]
19+
20+ export const hasVue = hasPackages ( VueJsPackages )
21+
22+ const RemixPackages = [
23+ '@remix-run/node' ,
24+ '@remix-run/react' ,
25+ '@remix-run/serve' ,
26+ '@remix-run/dev' ,
27+ ]
28+
29+ const NextJsPackages = [ 'next' ]
30+
31+ // export const hasReact = hasPackages(['react', ...RemixPackages, ...NextJsPackages])
32+ export const isUsingRemix = hasPackages ( RemixPackages )
33+ export const isUsingNext = hasPackages ( NextJsPackages )
34+
35+ function hasPackages ( packages : string [ ] ) {
36+ return packages . some ( name => isPackageExists ( name ) )
37+ }
You can’t perform that action at this time.
0 commit comments