@mpxjs/core 2.8.11 → 2.8.15
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/@types/node.d.ts +17 -0
- package/package.json +3 -3
- package/src/observer/reactive.js +3 -3
- package/src/observer/watch.js +3 -2
package/@types/node.d.ts
CHANGED
|
@@ -11,3 +11,20 @@ type EnvType = Dict<string>
|
|
|
11
11
|
declare let process: {
|
|
12
12
|
env: EnvType
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
declare namespace __WebpackModuleApi {
|
|
16
|
+
|
|
17
|
+
interface RequireContext {
|
|
18
|
+
keys(): string[];
|
|
19
|
+
(id: string): any;
|
|
20
|
+
<T>(id: string): T;
|
|
21
|
+
resolve(id: string): string;
|
|
22
|
+
/** The module id of the context module. This may be useful for module.hot.accept. */
|
|
23
|
+
id: string;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare namespace require {
|
|
28
|
+
export function context(path: string, deep?: boolean, filter?: RegExp, mode?: 'sync' | 'eager' | 'weak' | 'lazy' | 'lazy-once'): __WebpackModuleApi.RequireContext;
|
|
29
|
+
export function async<T>(path: string): Promise<T>
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/core",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.15",
|
|
4
4
|
"description": "mpx runtime core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"miniprogram",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"main": "src/index.js",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@mpxjs/utils": "^2.8.
|
|
22
|
+
"@mpxjs/utils": "^2.8.15",
|
|
23
23
|
"lodash": "^4.1.1",
|
|
24
24
|
"miniprogram-api-typings": "^3.0.2"
|
|
25
25
|
},
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"url": "https://github.com/didi/mpx/issues"
|
|
48
48
|
},
|
|
49
49
|
"sideEffects": false,
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "292c54cd571b1cdc3ca7cf9ffa8ab13ed2da6158"
|
|
51
51
|
}
|
package/src/observer/reactive.js
CHANGED
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
hasProto,
|
|
10
10
|
def,
|
|
11
11
|
isValidArrayIndex,
|
|
12
|
-
arrayProtoAugment
|
|
12
|
+
arrayProtoAugment,
|
|
13
|
+
hasChanged
|
|
13
14
|
} from '@mpxjs/utils'
|
|
14
15
|
|
|
15
16
|
const arrayKeys = Object.getOwnPropertyNames(arrayMethods)
|
|
@@ -138,8 +139,7 @@ export function defineReactive (obj, key, val, shallow) {
|
|
|
138
139
|
},
|
|
139
140
|
set: function reactiveSetter (newVal) {
|
|
140
141
|
const value = getter ? getter.call(obj) : val
|
|
141
|
-
|
|
142
|
-
if (!(shallow && isForceTrigger) && (newVal === value || (newVal !== newVal && value !== value))) {
|
|
142
|
+
if (!(shallow && isForceTrigger) && !hasChanged(newVal, value)) {
|
|
143
143
|
return
|
|
144
144
|
}
|
|
145
145
|
if (!shallow && isRef(value) && !isRef(newVal)) {
|
package/src/observer/watch.js
CHANGED
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
warn,
|
|
12
12
|
isArray,
|
|
13
13
|
remove,
|
|
14
|
-
callWithErrorHandling
|
|
14
|
+
callWithErrorHandling,
|
|
15
|
+
hasChanged
|
|
15
16
|
} from '@mpxjs/utils'
|
|
16
17
|
|
|
17
18
|
export function watchEffect (effect, options) {
|
|
@@ -30,7 +31,7 @@ const warnInvalidSource = (s) => {
|
|
|
30
31
|
warn(`Invalid watch source: ${s}\nA watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`)
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
const shouldTrigger = (value, oldValue) =>
|
|
34
|
+
const shouldTrigger = (value, oldValue) => hasChanged(value, oldValue) || isObject(value)
|
|
34
35
|
|
|
35
36
|
const processWatchOptionsCompat = (options) => {
|
|
36
37
|
const newOptions = { ...options }
|