@mpxjs/core 2.8.11 → 2.8.14

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 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.11",
3
+ "version": "2.8.14",
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.11",
22
+ "@mpxjs/utils": "^2.8.14",
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": "2a9e331eded74dd0eec214a90cfd34cbea17da70"
50
+ "gitHead": "47953f93b146a4998279b865e3c44041247a5006"
51
51
  }
@@ -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
- /* eslint-disable no-self-compare */
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)) {
@@ -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) => !Object.is(value, oldValue) || isObject(value)
34
+ const shouldTrigger = (value, oldValue) => hasChanged(value, oldValue) || isObject(value)
34
35
 
35
36
  const processWatchOptionsCompat = (options) => {
36
37
  const newOptions = { ...options }