@mpxjs/core 2.6.96 → 2.6.102

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/index.d.ts CHANGED
@@ -93,14 +93,14 @@ interface ObserversDefs {
93
93
  type GetDataType<T> = T extends () => any ? ReturnType<T> : T
94
94
 
95
95
  type PropValueType<Def> = Def extends {
96
- type: (...args: any[]) => infer T;
97
- optionalType?: ((...args: any[]) => infer T)[];
98
- value?: infer T;
99
- }
96
+ type: (...args: any[]) => infer T;
97
+ optionalType?: ((...args: any[]) => infer T)[];
98
+ value?: infer T;
99
+ }
100
100
  ? T
101
101
  : Def extends (...args: any[]) => infer T
102
- ? T
103
- : any;
102
+ ? T
103
+ : any;
104
104
 
105
105
  type GetPropsType<T> = {
106
106
  readonly [K in keyof T]: PropValueType<T[K]>
@@ -286,7 +286,7 @@ export function createActionsWithThis<S = {}, G = {}, M extends MutationsAndActi
286
286
 
287
287
  type MixinType = 'app' | 'page' | 'component'
288
288
 
289
- export function injectMixins (mixins: object | Array<object>, options?: { type?: MixinType | MixinType[], stage?: number }): void
289
+ export function injectMixins (mixins: object | Array<object>, options?: MixinType | MixinType[] | { types?: MixinType | MixinType[], stage?: number }): void
290
290
 
291
291
  export function watch (expr: string | (() => any), handler: WatchHandler | WatchOptWithHandler, options?: WatchOpt): () => void
292
292
 
@@ -304,6 +304,7 @@ interface MpxConfig {
304
304
  hookErrorHandler: (e: Error, target: ComponentIns<{}, {}, {}, {}, []>, hookName: string) => any | null
305
305
  proxyEventHandler: (e: Event) => any | null
306
306
  setDataHandler: (data: object, target: ComponentIns<{}, {}, {}, {}, []>) => any | null
307
+ forceRunWatcherSync: boolean
307
308
  }
308
309
 
309
310
  type SupportedMode = 'wx' | 'ali' | 'qq' | 'swan' | 'tt' | 'web' | 'qa'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/core",
3
- "version": "2.6.96",
3
+ "version": "2.6.102",
4
4
  "description": "mpx runtime core",
5
5
  "keywords": [
6
6
  "miniprogram",
@@ -40,5 +40,5 @@
40
40
  "url": "https://github.com/didi/mpx/issues"
41
41
  },
42
42
  "sideEffects": false,
43
- "gitHead": "5aa3f8e4f249737f8901054ac3cba1de4a5ded68"
43
+ "gitHead": "377633613e39511e147269e988e3459f50421de5"
44
44
  }
@@ -10,13 +10,5 @@ export default {
10
10
  }
11
11
  })
12
12
  }
13
- if (options.pageLifetimes && options.pageLifetimes.resize) {
14
- error(`Options.pageLifetimes.resize is not supported in tt environment!`, global.currentResource)
15
- delete options.pageLifetimes.resize
16
- }
17
- if (options.onResize) {
18
- error(`Options.onResize is not supported in tt environment!`, global.currentResource)
19
- delete options.onResize
20
- }
21
13
  }
22
14
  }
package/src/index.js CHANGED
@@ -204,7 +204,8 @@ EXPORT_MPX.config = {
204
204
  observeClassInstance: false,
205
205
  hookErrorHandler: null,
206
206
  proxyEventHandler: null,
207
- setDataHandler: null
207
+ setDataHandler: null,
208
+ forceRunWatcherSync: false
208
209
  }
209
210
 
210
211
  if (__mpx_mode__ === 'web') {
@@ -1,5 +1,6 @@
1
1
  import { asyncLock } from '../helper/utils'
2
2
  import { error } from '../helper/log'
3
+ import EXPORT_MPX from '../index'
3
4
 
4
5
  const queue = []
5
6
  let has = {}
@@ -16,6 +17,8 @@ export function queueWatcher (watcher) {
16
17
  run: watcher
17
18
  }
18
19
  }
20
+ // 开启EXPORT_MPX.config.forceRunWatcherSync时,queueWatcher同步执行,便于调试排查问题
21
+ if (EXPORT_MPX.config.forceRunWatcherSync) return watcher.run()
19
22
  if (!has[watcher.id] || watcher.id === Infinity) {
20
23
  has[watcher.id] = true
21
24
  if (!flushing) {