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 12, 2024
2 parents 948eda8 + 15d22fd commit 0d6209d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/webpack-plugin/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,8 @@ class MpxWebpackPlugin {
runtimeInfo: {},
// 记录运行时组件依赖的运行时组件当中使用的基础组件 slot,最终依据依赖关系注入到运行时组件的 json 配置当中
dynamicSlotDependencies: {},
// 模板引擎参数,用来检测模板引擎支持渲染的模板
dynamicTemplateRuleRunner: this.options.dynamicTemplateRuleRunner,
// 依据 package 注入到 mpx-custom-element-*.json 里面的组件路径
getPackageInjectedComponentsMap: (packageName = 'main') => {
const res = {}
Expand Down
4 changes: 4 additions & 0 deletions packages/webpack-plugin/lib/template-compiler/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2492,6 +2492,10 @@ function processElement (el, root, options, meta) {
return
}

if (runtimeCompile && options.dynamicTemplateRuleRunner) {
options.dynamicTemplateRuleRunner(el, options, config[mode])
}

if (rulesRunner && el._atModeStatus !== 'match') {
currentEl = el
rulesRunner(el)
Expand Down
3 changes: 2 additions & 1 deletion packages/webpack-plugin/lib/template-compiler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ module.exports = function (raw) {
checkUsingComponents: matchCondition(resourcePath, mpx.checkUsingComponentsRules),
globalComponents: Object.keys(mpx.usingComponents),
forceProxyEvent: matchCondition(resourcePath, mpx.forceProxyEventRules) || runtimeCompile,
hasVirtualHost: matchCondition(resourcePath, mpx.autoVirtualHostRules)
hasVirtualHost: matchCondition(resourcePath, mpx.autoVirtualHostRules),
dynamicTemplateRuleRunner: mpx.dynamicTemplateRuleRunner
})

if (meta.wxsContentMap) {
Expand Down

0 comments on commit 0d6209d

Please sign in to comment.