Skip to content

Commit

Permalink
feat(preset): add mobx & mobx-react-lite (#155)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
Jungzl and antfu committed Apr 13, 2022
1 parent 721b731 commit 6ad973b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/presets/index.ts
@@ -1,4 +1,6 @@
/* eslint-disable object-shorthand */
import mobx from './mobx'
import mobxReactLite from './mobx-react-lite'
import nuxtCompositionApi from './nuxt-composition-api'
import pinia from './pinia'
import preact from './preact'
Expand Down Expand Up @@ -37,6 +39,8 @@ export const presets = {
'@vue/composition-api': vueCompositionApi,
'@vueuse/core': vueuseCore,
'@vueuse/head': vueuseHead,
'mobx': mobx,
'mobx-react-lite': mobxReactLite,
'pinia': pinia,
'preact': preact,
'quasar': quasar,
Expand Down
12 changes: 12 additions & 0 deletions src/presets/mobx-react-lite.ts
@@ -0,0 +1,12 @@
import type { ImportsMap } from '../types'
import { mobx } from './mobx'

export default <ImportsMap>({
'mobx-react-lite': [
// https://pinia.esm.dev/api/modules/pinia.html#functions
...mobx,
'observer',
'Observer',
'useLocalObservable',
],
})
30 changes: 30 additions & 0 deletions src/presets/mobx.ts
@@ -0,0 +1,30 @@
import type { ImportsMap } from '../types'

export const mobx = [
// https://mobx.js.org/api.html
'makeObservable',
'makeAutoObservable',
'extendObservable',
'observable',
'action',
'runInAction',
'flow',
'flowResult',
'computed',
'autorun',
'reaction',
'when',
'onReactionError',
'intercept',
'observe',
'onBecomeObserved',
'onBecomeUnobserved',
'toJS',
]

export default <ImportsMap>({
mobx: [
// https://mobx.js.org/api.html
...mobx,
],
})

0 comments on commit 6ad973b

Please sign in to comment.