@mpxjs/store 2.8.23-alpha.2 → 2.8.28-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/store",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.28-beta.11",
|
|
4
4
|
"description": "A store for mpx framework",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "@types/index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"store"
|
|
17
17
|
],
|
|
18
18
|
"author": "donghongping",
|
|
19
|
-
"license": "
|
|
19
|
+
"license": "Apache-2.0",
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/didi/mpx/issues"
|
|
22
22
|
},
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/didi/mpx#readme",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@mpxjs/utils": "^2.8.
|
|
29
|
+
"@mpxjs/utils": "^2.8.28-beta.11"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@mpxjs/core": "^2.8.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "8c7fa579da9c3e71908eb9bfb5833a7d9477505d"
|
|
35
35
|
}
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import Mpx, { reactive, computed } from '@mpxjs/core'
|
|
2
|
-
import createHummerPlugin from './builtInPlugins/hummerStorePlugin'
|
|
3
2
|
import {
|
|
4
3
|
getByPath,
|
|
5
4
|
warn,
|
|
@@ -119,12 +118,6 @@ class Store {
|
|
|
119
118
|
this.state = this.registerModule(options).state
|
|
120
119
|
this.resetStoreVM()
|
|
121
120
|
Object.assign(this, mapStore(this))
|
|
122
|
-
if (__mpx_mode__ === 'tenon') {
|
|
123
|
-
plugins.push(createHummerPlugin({
|
|
124
|
-
/* eslint-disable camelcase */
|
|
125
|
-
store_key: `MPX_STORE${options.__store_id}`
|
|
126
|
-
}))
|
|
127
|
-
}
|
|
128
121
|
plugins.forEach(plugin => plugin(this))
|
|
129
122
|
}
|
|
130
123
|
|
|
@@ -153,9 +146,9 @@ class Store {
|
|
|
153
146
|
|
|
154
147
|
registerModule (module) {
|
|
155
148
|
const state = module.state || {}
|
|
156
|
-
const reactiveModule =
|
|
157
|
-
|
|
158
|
-
|
|
149
|
+
const reactiveModule = {
|
|
150
|
+
state
|
|
151
|
+
}
|
|
159
152
|
if (module.getters) {
|
|
160
153
|
reactiveModule.getters = transformGetters(module.getters, reactiveModule, this)
|
|
161
154
|
}
|
|
@@ -196,16 +189,6 @@ class Store {
|
|
|
196
189
|
const computedKeys = Object.keys(this.__wrappedGetters)
|
|
197
190
|
proxy(this.getters, vm, computedKeys)
|
|
198
191
|
proxy(this.getters, this.__depsGetters)
|
|
199
|
-
} else if (__mpx_mode__ === 'tenon') {
|
|
200
|
-
const computedObj = {}
|
|
201
|
-
Object.keys(this.__wrappedGetters).forEach(k => {
|
|
202
|
-
const getter = this.__wrappedGetters[k]
|
|
203
|
-
computedObj[k] = () => getter(this.state)
|
|
204
|
-
Object.defineProperty(this.getters, k, {
|
|
205
|
-
get: () => computedObj[k](),
|
|
206
|
-
enumerable: true // for local getters
|
|
207
|
-
})
|
|
208
|
-
})
|
|
209
192
|
} else {
|
|
210
193
|
reactive(this.state)
|
|
211
194
|
const computedObj = {}
|
|
@@ -216,19 +199,6 @@ class Store {
|
|
|
216
199
|
proxy(this.getters, this.__depsGetters)
|
|
217
200
|
}
|
|
218
201
|
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* 替换state,tenon环境中使用
|
|
222
|
-
*/
|
|
223
|
-
replaceState (state) {
|
|
224
|
-
// todo 某些key可能无法删除
|
|
225
|
-
Object.assign(this.state, state)
|
|
226
|
-
// this.resetStoreVM()
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
_withCommit (fn) {
|
|
230
|
-
fn()
|
|
231
|
-
}
|
|
232
202
|
}
|
|
233
203
|
|
|
234
204
|
function genericSubscribe (fn, subs, options) {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default () => () => {} // mock plugin in other mode
|