@mpxjs/core 2.8.2 → 2.8.4
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
|
@@ -428,7 +428,7 @@ type WatchSource<T> =
|
|
|
428
428
|
| (() => T) // getter
|
|
429
429
|
| ComputedRef<T>
|
|
430
430
|
|
|
431
|
-
type MultiWatchSources = (WatchSource<unknown> | object)[]
|
|
431
|
+
// type MultiWatchSources = (WatchSource<unknown> | object)[]
|
|
432
432
|
|
|
433
433
|
interface WatchEffectOptions {
|
|
434
434
|
flush?: 'pre' | 'post' | 'sync' // default: 'pre'
|
|
@@ -528,14 +528,11 @@ export function watchPostEffect (
|
|
|
528
528
|
options?: WatchEffectOptions
|
|
529
529
|
): void
|
|
530
530
|
|
|
531
|
-
export function watch<T extends
|
|
532
|
-
sources: [...T],
|
|
533
|
-
callback: WatchCallback<T>,
|
|
534
|
-
options?: WatchOptions
|
|
535
|
-
): () => void
|
|
536
|
-
export function watch<T extends Readonly<MultiWatchSources>> (
|
|
531
|
+
export function watch<T extends Readonly<(WatchSource<unknown> | object)[]>> (
|
|
537
532
|
sources: T,
|
|
538
|
-
callback: WatchCallback<
|
|
533
|
+
callback: WatchCallback<{
|
|
534
|
+
[K in keyof T]: T[K] extends WatchSource<infer V> ? V : T[K] extends object ? T[K] : never
|
|
535
|
+
}>,
|
|
539
536
|
options?: WatchOptions
|
|
540
537
|
): () => void
|
|
541
538
|
export function watch<T> ( // for single watcher
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/core",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.4",
|
|
4
4
|
"description": "mpx runtime core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"miniprogram",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"url": "https://github.com/didi/mpx/issues"
|
|
48
48
|
},
|
|
49
49
|
"sideEffects": false,
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "a86c688ee61f5c313feb1b1c28d03ab26cd42d37"
|
|
51
51
|
}
|
package/src/core/mergeOptions.js
CHANGED
|
@@ -15,7 +15,7 @@ let curType
|
|
|
15
15
|
let convertRule
|
|
16
16
|
let mpxCustomKeysMap
|
|
17
17
|
|
|
18
|
-
export default function mergeOptions (options = {}, type, needConvert
|
|
18
|
+
export default function mergeOptions (options = {}, type, needConvert) {
|
|
19
19
|
// 缓存混合模式下的自定义属性列表
|
|
20
20
|
mpxCustomKeysMap = makeMap(options.mpxCustomKeysForBlend || [])
|
|
21
21
|
// needConvert为false,表示衔接原生的root配置,那么此时的配置都是当前原生环境支持的配置,不需要转换
|
|
@@ -3,7 +3,7 @@ import mergeOptions from './mergeOptions'
|
|
|
3
3
|
import { getConvertMode } from '../convertor/getConvertMode'
|
|
4
4
|
import { warn, findItem } from '@mpxjs/utils'
|
|
5
5
|
|
|
6
|
-
export default function transferOptions (options, type) {
|
|
6
|
+
export default function transferOptions (options, type, needConvert = true) {
|
|
7
7
|
let currentInject
|
|
8
8
|
if (global.currentInject && global.currentInject.moduleId === global.currentModuleId) {
|
|
9
9
|
currentInject = global.currentInject
|
|
@@ -28,7 +28,7 @@ export default function transferOptions (options, type) {
|
|
|
28
28
|
}
|
|
29
29
|
// 转换mode
|
|
30
30
|
options.mpxConvertMode = options.mpxConvertMode || getConvertMode(global.currentSrcMode)
|
|
31
|
-
const rawOptions = mergeOptions(options, type)
|
|
31
|
+
const rawOptions = mergeOptions(options, type, needConvert)
|
|
32
32
|
|
|
33
33
|
if (currentInject && currentInject.propKeys) {
|
|
34
34
|
const computedKeys = Object.keys(rawOptions.computed || {})
|
|
@@ -68,7 +68,8 @@ export default function createApp (option, config = {}) {
|
|
|
68
68
|
}
|
|
69
69
|
})
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
// app选项目前不需要进行转换
|
|
72
|
+
const { rawOptions } = transferOptions(option, 'app', false)
|
|
72
73
|
rawOptions.mixins = builtInMixins
|
|
73
74
|
const defaultOptions = filterOptions(spreadProp(mergeOptions(rawOptions, 'app', false), 'methods'), appData)
|
|
74
75
|
|