Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/didi/mpx
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyuki committed Aug 5, 2024
2 parents 6b0b9e1 + 3fe5773 commit 5bcd9b8
Show file tree
Hide file tree
Showing 16 changed files with 54 additions and 27 deletions.
4 changes: 2 additions & 2 deletions docs-vuepress/api/ApiIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -733,8 +733,8 @@ const data = [
anchor: '#autoVirtualHostRules'
},
{
text: 'partialCompile',
anchor: '#partialCompile'
text: 'partialCompileRules',
anchor: '#partialCompileRules'
},
]
},
Expand Down
6 changes: 4 additions & 2 deletions docs-vuepress/api/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -966,20 +966,22 @@ module.exports = defineConfig({
})
```

### partialCompile
### partialCompileRules

`{ include: string | RegExp | Function | Array<string | RegExp | Function> }`

在大型的小程序开发当中,全量打包页面耗时非常长,往往在`开发过程`中仅仅只需用到几个 pages 而已,该配置项支持打包指定的小程序页面。

**注意:** @mpxjs/webpack-plugin@2.9.41版本之前该配置为 partialCompile。

```js
// vue.config.js
module.exports = defineConfig({
pluginOptions: {
mpx: {
plugin: {
// include 可以是正则、字符串、函数、数组
partialCompile: {
partialCompileRules: {
include: '/project/pages', // 文件路径包含 '/project/pages' 的页面都会被打包
include: /pages\/internal/, // 文件路径能与正则匹配上的页面都会被打包
include (pageResourcePath) {
Expand Down
9 changes: 7 additions & 2 deletions examples/mpx-webview/H5/webviewbridge.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"packages": [
"packages/*"
],
"version": "2.9.43"
"version": "2.9.47"
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mpxjs/core",
"version": "2.9.43",
"version": "2.9.47",
"description": "mpx runtime core",
"keywords": [
"miniprogram",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/core/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ export default class MpxProxy {
this.callHook(BEFOREUNMOUNT)
this.scope?.stop()
if (this.update) this.update.active = false
this.state = UNMOUNTED
this.callHook(UNMOUNTED)
this.state = UNMOUNTED
}

isUnmounted () {
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/platform/builtInMixins/proxyEventMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export default function proxyEventMixin () {
}
const location = this.__mpxProxy.options.mpxFileResource
const type = $event.type
// thanos 平台特殊事件标识
const emitMode = $event.detail && $event.detail.mpxEmit
if (!type) {
error('Event object must have [type] property!', location)
return
Expand All @@ -44,6 +46,10 @@ export default function proxyEventMixin () {
let returnedValue
curEventConfig.forEach((item) => {
const callbackName = item[0]
if (emitMode) {
// thanos 平台特殊事件标识处理
$event = $event.detail.data
}
if (callbackName) {
const params = item.length > 1
? item.slice(1).map(item => {
Expand Down
2 changes: 1 addition & 1 deletion packages/unocss-base/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = function presetMpx (options = {}) {
name: '@mpxjs/unocss-base',
theme: {
...uno.theme,
preflightRoot: ['page,view,text,div,span,::before,::after,::backdrop']
preflightRoot: ['page,view,text,div,span,::before,::after']
},
postprocess: (util) => {
util.entries.forEach((i) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/unocss-base/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@mpxjs/unocss-base",
"description": "mpx unocss base preset",
"version": "2.9.35",
"version": "2.9.46",
"main": "lib/index.js",
"directories": {
"lib": "lib"
Expand Down
7 changes: 4 additions & 3 deletions packages/webview-bridge/dist/webviewbridge.esm.browser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* mpxjs webview bridge v2.9.17
* mpxjs webview bridge v2.9.41
* (c) 2024 @mpxjs team
* @license Apache
*/
Expand Down Expand Up @@ -58,7 +58,7 @@ const SDK_URL_MAP = {
url: 'https://b.bdstatic.com/searchbox/icms/searchbox/js/swan-2.0.4.js'
},
tt: {
url: 'https://s3.pstatp.com/toutiao/tmajssdk/jssdk.js'
url: 'https://lf3-cdn-tos.bytegoofy.com/obj/goofy/developer/jssdk/jssdk-1.2.1.js'
},
...window.sdkUrlMap
};
Expand Down Expand Up @@ -306,7 +306,8 @@ const getWebviewApi = () => {
'postMessage',
'getLoadError',
'getLocation'
]
],
tt: []
};
const multiApi = multiApiMap[env] || {};
const singleApi = singleApiMap[env] || {};
Expand Down
Loading

0 comments on commit 5bcd9b8

Please sign in to comment.