@mpxjs/core 2.7.0-beta.5 → 2.7.0-beta.6
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 +2 -1
- package/package.json +3 -2
- package/src/index.js +5 -4
- package/src/platform/createApp.js +7 -1
package/@types/index.d.ts
CHANGED
|
@@ -304,7 +304,8 @@ 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
|
+
forceRunWatcherSync: boolean,
|
|
308
|
+
webRouteConfig: object
|
|
308
309
|
}
|
|
309
310
|
|
|
310
311
|
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.7.0-beta.
|
|
3
|
+
"version": "2.7.0-beta.6",
|
|
4
4
|
"description": "mpx runtime core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"miniprogram",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"src",
|
|
18
18
|
"@types"
|
|
19
19
|
],
|
|
20
|
+
"main": "src/index.js",
|
|
20
21
|
"dependencies": {
|
|
21
22
|
"lodash": "^4.1.1",
|
|
22
23
|
"miniprogram-api-typings": "^3.0.2"
|
|
@@ -40,5 +41,5 @@
|
|
|
40
41
|
"url": "https://github.com/didi/mpx/issues"
|
|
41
42
|
},
|
|
42
43
|
"sideEffects": false,
|
|
43
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "c04233503af0b1c7b4410fd03582d9dd883182d9"
|
|
44
45
|
}
|
package/src/index.js
CHANGED
|
@@ -205,12 +205,13 @@ EXPORT_MPX.config = {
|
|
|
205
205
|
hookErrorHandler: null,
|
|
206
206
|
proxyEventHandler: null,
|
|
207
207
|
setDataHandler: null,
|
|
208
|
-
forceRunWatcherSync: false
|
|
208
|
+
forceRunWatcherSync: false,
|
|
209
|
+
webRouteConfig: {}
|
|
209
210
|
}
|
|
210
211
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
global.__mpx = EXPORT_MPX
|
|
213
|
+
|
|
214
|
+
if (__mpx_mode__ !== 'web') {
|
|
214
215
|
if (global.i18n) {
|
|
215
216
|
observe(global.i18n)
|
|
216
217
|
// 挂载翻译方法
|
|
@@ -3,6 +3,7 @@ import mergeOptions from '../core/mergeOptions'
|
|
|
3
3
|
import builtInKeysMap from './patch/builtInKeysMap'
|
|
4
4
|
import { makeMap, spreadProp } from '../helper/utils'
|
|
5
5
|
import * as webLifecycle from '../platform/patch/web/lifecycle'
|
|
6
|
+
import EXPORT_MPX from '../index'
|
|
6
7
|
|
|
7
8
|
const webAppHooksMap = makeMap(webLifecycle.LIFECYCLE.APP_HOOKS)
|
|
8
9
|
|
|
@@ -22,7 +23,12 @@ function filterOptions (options, appData) {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export default function createApp (option, config = {}) {
|
|
25
|
-
|
|
26
|
+
// 在App中挂载mpx对象供周边工具访问,如e2e测试
|
|
27
|
+
const builtInMixins = [{
|
|
28
|
+
getMpx () {
|
|
29
|
+
return EXPORT_MPX
|
|
30
|
+
}
|
|
31
|
+
}]
|
|
26
32
|
const appData = {}
|
|
27
33
|
if (__mpx_mode__ === 'web') {
|
|
28
34
|
builtInMixins.push({
|