@mpxjs/webpack-plugin 2.7.50-alpha.0 → 2.7.50-alpha.3
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.
|
@@ -1957,7 +1957,7 @@ function postProcessTemplate (el) {
|
|
|
1957
1957
|
}
|
|
1958
1958
|
}
|
|
1959
1959
|
|
|
1960
|
-
const isValidMode = makeMap('wx,ali,swan,tt,qq,web,qa,jd,dd')
|
|
1960
|
+
const isValidMode = makeMap('wx,ali,swan,tt,qq,web,qa,jd,dd,noMode')
|
|
1961
1961
|
|
|
1962
1962
|
const wrapRE = /^\((.*)\)$/
|
|
1963
1963
|
|
|
@@ -1996,7 +1996,7 @@ function processAtMode (el) {
|
|
|
1996
1996
|
conditionMap.set(key, arr.slice(1))
|
|
1997
1997
|
})
|
|
1998
1998
|
|
|
1999
|
-
const modeArr =
|
|
1999
|
+
const modeArr = [...conditionMap.keys()]
|
|
2000
2000
|
|
|
2001
2001
|
if (modeArr.every(i => isValidMode(i))) {
|
|
2002
2002
|
const attrValue = getAndRemoveAttr(el, attrName).val
|
|
@@ -2007,20 +2007,24 @@ function processAtMode (el) {
|
|
|
2007
2007
|
if (defineMode === 'noMode' || defineMode === mode) {
|
|
2008
2008
|
// 命中 env 规则(没有定义env 或者定义的envArr包含当前env)
|
|
2009
2009
|
if (!defineEnvArr.length || defineEnvArr.includes(env)) {
|
|
2010
|
-
|
|
2011
|
-
if (
|
|
2012
|
-
|
|
2010
|
+
el._atModeStatus = ''
|
|
2011
|
+
if (!replacedAttrName) {
|
|
2012
|
+
// 若defineMode 为 noMode,则不论是element,还是attr,都需要经过规则转换
|
|
2013
|
+
if (defineMode !== 'noMode') {
|
|
2013
2014
|
el._atModeStatus = 'match'
|
|
2014
|
-
} else {
|
|
2015
|
-
// 如果命中了指定的mode,则先存在el上,等跑完转换后再挂回去
|
|
2016
|
-
el.noTransAttrs ? el.noTransAttrs.push(processedAttr) : el.noTransAttrs = [processedAttr]
|
|
2017
2015
|
}
|
|
2016
|
+
} else {
|
|
2017
|
+
// 如果命中了指定的mode,则先存在el上,等跑完转换后再挂回去
|
|
2018
|
+
el.noTransAttrs ? el.noTransAttrs.push(processedAttr) : el.noTransAttrs = [processedAttr]
|
|
2018
2019
|
}
|
|
2019
|
-
//
|
|
2020
|
+
// 命中mode,命中env,完成匹配,直接退出
|
|
2020
2021
|
break
|
|
2022
|
+
} else if (!replacedAttrName) {
|
|
2023
|
+
// 命中mode规则,没有命中当前env规则,设置为 'mismatch'
|
|
2024
|
+
el._atModeStatus = 'mismatch'
|
|
2021
2025
|
}
|
|
2022
2026
|
} else if (!replacedAttrName) {
|
|
2023
|
-
//
|
|
2027
|
+
// 没有命中当前mode规则,设置为 'mismatch'
|
|
2024
2028
|
el._atModeStatus = 'mismatch'
|
|
2025
2029
|
} else {
|
|
2026
2030
|
// 如果没命中指定的mode,则该属性删除
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.7.50-alpha.
|
|
3
|
+
"version": "2.7.50-alpha.3",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"engines": {
|
|
81
81
|
"node": ">=14.14.0"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "149081b776c5684bb60a2e26f6e3e0ecb5e60a66"
|
|
84
84
|
}
|