Skip to content

Commit

Permalink
feat: add preact/compat preset (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
GoodbyeNJN committed Sep 19, 2022
1 parent 68895e0 commit c1c9752
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
6 changes: 6 additions & 0 deletions src/presets/preact-compat.ts
@@ -0,0 +1,6 @@
import type { ImportsMap } from '../types'
import { CommonReactAPI } from './react'

export default <ImportsMap>({
'preact/compat': CommonReactAPI,
})
46 changes: 24 additions & 22 deletions src/presets/react.ts
@@ -1,26 +1,28 @@
import type { ImportsMap } from '../types'

export const CommonReactAPI = [
'useState',
'useCallback',
'useMemo',
'useEffect',
'useRef',
'useContext',
'useReducer',
'useImperativeHandle',
'useDebugValue',
'useDeferredValue',
'useLayoutEffect',
'useTransition',
'startTransition',
'useSyncExternalStore',
'useInsertionEffect',
'useId',
'lazy',
'memo',
'createRef',
'forwardRef',
]

export default <ImportsMap>({
react: [
'useState',
'useCallback',
'useMemo',
'useEffect',
'useRef',
'useContext',
'useReducer',
'useImperativeHandle',
'useDebugValue',
'useDeferredValue',
'useLayoutEffect',
'useTransition',
'startTransition',
'useSyncExternalStore',
'useInsertionEffect',
'useId',
'lazy',
'memo',
'createRef',
'forwardRef',
],
react: CommonReactAPI,
})

0 comments on commit c1c9752

Please sign in to comment.