@mpxjs/webpack-plugin 2.9.67 → 2.9.69-beta.0
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/lib/index.js +13 -8
- package/lib/platform/json/wx/index.js +21 -8
- package/lib/platform/style/wx/index.js +35 -38
- package/lib/platform/template/wx/component-config/canvas.js +8 -0
- package/lib/platform/template/wx/component-config/fix-component-name.js +15 -12
- package/lib/platform/template/wx/component-config/index.js +1 -1
- package/lib/platform/template/wx/component-config/input.js +1 -1
- package/lib/platform/template/wx/component-config/rich-text.js +8 -0
- package/lib/platform/template/wx/component-config/swiper.js +1 -1
- package/lib/platform/template/wx/component-config/textarea.js +1 -1
- package/lib/platform/template/wx/component-config/unsupported.js +1 -1
- package/lib/react/processStyles.js +14 -4
- package/lib/react/processTemplate.js +3 -0
- package/lib/resolver/AddModePlugin.js +8 -8
- package/lib/runtime/components/react/context.ts +6 -0
- package/lib/runtime/components/react/dist/context.js +2 -0
- package/lib/runtime/components/react/dist/event.config.js +24 -24
- package/lib/runtime/components/react/dist/getInnerListeners.js +183 -174
- package/lib/runtime/components/react/dist/mpx-button.jsx +77 -49
- package/lib/runtime/components/react/dist/mpx-canvas/Bus.js +60 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.js +15 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.js +84 -0
- package/lib/runtime/components/react/dist/mpx-canvas/Image.js +87 -0
- package/lib/runtime/components/react/dist/mpx-canvas/ImageData.js +15 -0
- package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.js +28 -0
- package/lib/runtime/components/react/dist/mpx-canvas/html.js +343 -0
- package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +232 -0
- package/lib/runtime/components/react/dist/mpx-canvas/utils.jsx +89 -0
- package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +13 -19
- package/lib/runtime/components/react/dist/mpx-checkbox.jsx +29 -38
- package/lib/runtime/components/react/dist/mpx-form.jsx +16 -19
- package/lib/runtime/components/react/dist/mpx-icon.jsx +8 -16
- package/lib/runtime/components/react/dist/mpx-image.jsx +291 -0
- package/lib/runtime/components/react/dist/mpx-input.jsx +54 -27
- package/lib/runtime/components/react/dist/mpx-label.jsx +15 -22
- package/lib/runtime/components/react/dist/mpx-movable-area.jsx +13 -16
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +13 -13
- package/lib/runtime/components/react/dist/mpx-navigator.jsx +2 -4
- package/lib/runtime/components/react/dist/mpx-picker/date.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/index.jsx +5 -3
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/region.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/selector.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/time.jsx +10 -15
- package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +39 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +160 -88
- package/lib/runtime/components/react/dist/mpx-picker-view.jsx +80 -121
- package/lib/runtime/components/react/dist/mpx-radio-group.jsx +11 -19
- package/lib/runtime/components/react/dist/mpx-radio.jsx +27 -42
- package/lib/runtime/components/react/dist/mpx-rich-text/html.js +39 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +63 -0
- package/lib/runtime/components/react/dist/mpx-root-portal.jsx +6 -4
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +47 -41
- package/lib/runtime/components/react/dist/mpx-simple-text.jsx +11 -0
- package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +4 -2
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +606 -0
- package/lib/runtime/components/react/dist/mpx-switch.jsx +20 -10
- package/lib/runtime/components/react/dist/mpx-text.jsx +11 -10
- package/lib/runtime/components/react/dist/mpx-textarea.jsx +8 -3
- package/lib/runtime/components/react/dist/mpx-view.jsx +65 -61
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +112 -35
- package/lib/runtime/components/react/dist/pickerFaces.js +81 -0
- package/lib/runtime/components/react/dist/pickerVIewContext.js +9 -0
- package/lib/runtime/components/react/dist/pickerViewMask.jsx +18 -0
- package/lib/runtime/components/react/dist/pickerViewOverlay.jsx +23 -0
- package/lib/runtime/components/react/dist/useAnimationHooks.js +35 -9
- package/lib/runtime/components/react/dist/utils.jsx +70 -23
- package/lib/runtime/components/react/event.config.ts +25 -26
- package/lib/runtime/components/react/getInnerListeners.ts +237 -199
- package/lib/runtime/components/react/mpx-button.tsx +104 -57
- package/lib/runtime/components/react/mpx-canvas/Bus.ts +70 -0
- package/lib/runtime/components/react/mpx-canvas/CanvasGradient.ts +18 -0
- package/lib/runtime/components/react/mpx-canvas/CanvasRenderingContext2D.ts +87 -0
- package/lib/runtime/components/react/mpx-canvas/Image.ts +102 -0
- package/lib/runtime/components/react/mpx-canvas/ImageData.ts +23 -0
- package/lib/runtime/components/react/mpx-canvas/constructorsRegistry.ts +38 -0
- package/lib/runtime/components/react/mpx-canvas/html.ts +343 -0
- package/lib/runtime/components/react/mpx-canvas/index.tsx +296 -0
- package/lib/runtime/components/react/mpx-canvas/utils.tsx +150 -0
- package/lib/runtime/components/react/mpx-checkbox-group.tsx +28 -25
- package/lib/runtime/components/react/mpx-checkbox.tsx +48 -49
- package/lib/runtime/components/react/mpx-form.tsx +25 -28
- package/lib/runtime/components/react/mpx-icon.tsx +12 -17
- package/lib/runtime/components/react/mpx-image.tsx +436 -0
- package/lib/runtime/components/react/mpx-input.tsx +77 -57
- package/lib/runtime/components/react/mpx-label.tsx +26 -27
- package/lib/runtime/components/react/mpx-movable-area.tsx +18 -23
- package/lib/runtime/components/react/mpx-movable-view.tsx +21 -25
- package/lib/runtime/components/react/mpx-navigator.tsx +2 -8
- package/lib/runtime/components/react/mpx-picker/date.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/index.tsx +3 -2
- package/lib/runtime/components/react/mpx-picker/multiSelector.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/region.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/selector.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/time.tsx +10 -15
- package/lib/runtime/components/react/mpx-picker/type.ts +48 -43
- package/lib/runtime/components/react/mpx-picker-view-column.tsx +236 -104
- package/lib/runtime/components/react/mpx-picker-view.tsx +132 -122
- package/lib/runtime/components/react/mpx-radio-group.tsx +24 -27
- package/lib/runtime/components/react/mpx-radio.tsx +45 -54
- package/lib/runtime/components/react/mpx-rich-text/html.ts +40 -0
- package/lib/runtime/components/react/mpx-rich-text/index.tsx +121 -0
- package/lib/runtime/components/react/mpx-root-portal.tsx +3 -5
- package/lib/runtime/components/react/mpx-scroll-view.tsx +72 -71
- package/lib/runtime/components/react/mpx-simple-text.tsx +18 -0
- package/lib/runtime/components/react/mpx-swiper/carouse.tsx +4 -2
- package/lib/runtime/components/react/mpx-swiper-item.tsx +3 -2
- package/lib/runtime/components/react/mpx-switch.tsx +29 -23
- package/lib/runtime/components/react/mpx-text.tsx +14 -18
- package/lib/runtime/components/react/mpx-textarea.tsx +11 -10
- package/lib/runtime/components/react/mpx-view.tsx +92 -76
- package/lib/runtime/components/react/mpx-web-view.tsx +116 -54
- package/lib/runtime/components/react/pickerFaces.ts +104 -0
- package/lib/runtime/components/react/pickerOverlay.tsx +32 -0
- package/lib/runtime/components/react/types/common.ts +2 -0
- package/lib/runtime/components/react/types/global.d.ts +5 -17
- package/lib/runtime/components/react/useAnimationHooks.ts +36 -11
- package/lib/runtime/components/react/utils.tsx +99 -28
- package/lib/runtime/components/web/getInnerListeners.js +6 -6
- package/lib/runtime/components/web/mpx-movable-view.vue +334 -344
- package/lib/runtime/components/web/mpx-picker-view-column.vue +75 -75
- package/lib/runtime/components/web/mpx-picker.vue +382 -385
- package/lib/runtime/components/web/mpx-web-view.vue +175 -161
- package/lib/runtime/optionProcessor.js +7 -38
- package/lib/runtime/utils.js +2 -0
- package/lib/style-compiler/plugins/scope-id.js +30 -2
- package/lib/template-compiler/bind-this.js +7 -2
- package/lib/template-compiler/compiler.js +79 -47
- package/lib/template-compiler/gen-node-react.js +3 -3
- package/lib/utils/pre-process-json.js +9 -5
- package/package.json +6 -4
- package/LICENSE +0 -433
- package/lib/runtime/components/react/dist/mpx-image/index.jsx +0 -226
- package/lib/runtime/components/react/dist/mpx-image/svg.jsx +0 -7
- package/lib/runtime/components/react/dist/mpx-swiper/carouse.jsx +0 -478
- package/lib/runtime/components/react/dist/mpx-swiper/index.jsx +0 -68
- package/lib/runtime/components/react/dist/mpx-swiper/type.js +0 -1
- package/lib/runtime/components/react/mpx-image/index.tsx +0 -345
- package/lib/runtime/components/react/mpx-image/svg.tsx +0 -22
- package/lib/runtime/components/web/event.js +0 -105
|
@@ -117,6 +117,7 @@ let hasOptionalChaining = false
|
|
|
117
117
|
let processingTemplate = false
|
|
118
118
|
const rulesResultMap = new Map()
|
|
119
119
|
let usingComponents = []
|
|
120
|
+
let usingComponentsInfo = {}
|
|
120
121
|
|
|
121
122
|
function updateForScopesMap () {
|
|
122
123
|
forScopesMap = {}
|
|
@@ -636,6 +637,7 @@ function parse (template, options) {
|
|
|
636
637
|
|
|
637
638
|
if (typeof options.usingComponentsInfo === 'string') options.usingComponentsInfo = JSON.parse(options.usingComponentsInfo)
|
|
638
639
|
usingComponents = Object.keys(options.usingComponentsInfo)
|
|
640
|
+
usingComponentsInfo = options.usingComponentsInfo
|
|
639
641
|
|
|
640
642
|
const _warn = content => {
|
|
641
643
|
const currentElementRuleResult = rulesResultMap.get(currentEl) || rulesResultMap.set(currentEl, {
|
|
@@ -725,7 +727,7 @@ function parse (template, options) {
|
|
|
725
727
|
stack.push(element)
|
|
726
728
|
} else {
|
|
727
729
|
element.unary = true
|
|
728
|
-
closeElement(element,
|
|
730
|
+
closeElement(element, options, meta)
|
|
729
731
|
}
|
|
730
732
|
},
|
|
731
733
|
|
|
@@ -740,7 +742,7 @@ function parse (template, options) {
|
|
|
740
742
|
// pop stack
|
|
741
743
|
stack.pop()
|
|
742
744
|
currentParent = stack[stack.length - 1]
|
|
743
|
-
closeElement(element,
|
|
745
|
+
closeElement(element, options, meta)
|
|
744
746
|
}
|
|
745
747
|
},
|
|
746
748
|
|
|
@@ -765,7 +767,7 @@ function parse (template, options) {
|
|
|
765
767
|
parent: currentParent
|
|
766
768
|
}
|
|
767
769
|
children.push(el)
|
|
768
|
-
runtimeCompile ? processTextDynamic(el) : processText(el)
|
|
770
|
+
runtimeCompile ? processTextDynamic(el) : processText(el, options, meta)
|
|
769
771
|
}
|
|
770
772
|
},
|
|
771
773
|
comment: function comment (text) {
|
|
@@ -1164,7 +1166,7 @@ function processEventReact (el) {
|
|
|
1164
1166
|
configs: []
|
|
1165
1167
|
}
|
|
1166
1168
|
}
|
|
1167
|
-
eventConfigMap[type].configs.push(Object.assign({ name }, parsedFunc))
|
|
1169
|
+
eventConfigMap[type].configs.push(Object.assign({ name, value }, parsedFunc))
|
|
1168
1170
|
}
|
|
1169
1171
|
}
|
|
1170
1172
|
})
|
|
@@ -1205,26 +1207,32 @@ function processEventReact (el) {
|
|
|
1205
1207
|
|
|
1206
1208
|
// let wrapper
|
|
1207
1209
|
for (const type in eventConfigMap) {
|
|
1208
|
-
|
|
1209
|
-
configs.
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1210
|
+
const { configs } = eventConfigMap[type]
|
|
1211
|
+
if (!configs.length) continue
|
|
1212
|
+
const needBind = configs.length > 1 || configs[0].hasArgs
|
|
1213
|
+
if (needBind) {
|
|
1214
|
+
configs.forEach(({ name }) => {
|
|
1215
|
+
if (name) {
|
|
1216
|
+
// 清空原始事件绑定
|
|
1217
|
+
let has
|
|
1218
|
+
do {
|
|
1219
|
+
has = getAndRemoveAttr(el, name).has
|
|
1220
|
+
} while (has)
|
|
1221
|
+
}
|
|
1222
|
+
})
|
|
1223
|
+
const value = `{{(e)=>this.__invoke(e, [${configs.map(item => item.expStr)}])}}`
|
|
1224
|
+
addAttrs(el, [
|
|
1225
|
+
{
|
|
1226
|
+
name: type,
|
|
1227
|
+
value
|
|
1228
|
+
}
|
|
1229
|
+
])
|
|
1230
|
+
} else {
|
|
1231
|
+
const { name, value } = configs[0]
|
|
1232
|
+
const { result } = parseMustacheWithContext(value)
|
|
1233
|
+
modifyAttr(el, name, `{{this[${result}]}}`)
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1228
1236
|
// 非button的情况下,press/longPress时间需要包裹TouchableWithoutFeedback进行响应,后续可支持配置
|
|
1229
1237
|
// if ((type === 'press' || type === 'longPress') && el.tag !== 'mpx-button') {
|
|
1230
1238
|
// if (!wrapper) {
|
|
@@ -1374,7 +1382,8 @@ function processEvent (el, options) {
|
|
|
1374
1382
|
function processSlotReact (el, meta) {
|
|
1375
1383
|
if (el.tag === 'slot') {
|
|
1376
1384
|
el.slot = {
|
|
1377
|
-
name: getAndRemoveAttr(el, 'name').val
|
|
1385
|
+
name: getAndRemoveAttr(el, 'name').val,
|
|
1386
|
+
slot: getAndRemoveAttr(el, 'slot').val
|
|
1378
1387
|
}
|
|
1379
1388
|
meta.options = meta.options || {}
|
|
1380
1389
|
meta.options.disableMemo = true
|
|
@@ -1921,7 +1930,7 @@ function postProcessFor (el) {
|
|
|
1921
1930
|
function postProcessForReact (el) {
|
|
1922
1931
|
if (el.for) {
|
|
1923
1932
|
if (el.for.key) {
|
|
1924
|
-
addExp(el, `this.__getWxKey(${el.for.item || 'item'}, ${stringify(el.for.key)})`, false, 'key')
|
|
1933
|
+
addExp(el, `this.__getWxKey(${el.for.item || 'item'}, ${stringify(el.for.key)}, ${el.for.index || 'index'})`, false, 'key')
|
|
1925
1934
|
addAttrs(el, [{
|
|
1926
1935
|
name: 'key',
|
|
1927
1936
|
value: el.for.key
|
|
@@ -2035,7 +2044,7 @@ function postProcessIfReact (el) {
|
|
|
2035
2044
|
}
|
|
2036
2045
|
}
|
|
2037
2046
|
|
|
2038
|
-
function processText (el) {
|
|
2047
|
+
function processText (el, options, meta) {
|
|
2039
2048
|
if (el.type !== 3 || el.isComment) {
|
|
2040
2049
|
return
|
|
2041
2050
|
}
|
|
@@ -2045,17 +2054,38 @@ function processText (el) {
|
|
|
2045
2054
|
}
|
|
2046
2055
|
el.text = parsed.val
|
|
2047
2056
|
if (isReact(mode)) {
|
|
2048
|
-
processWrapTextReact(el)
|
|
2057
|
+
processWrapTextReact(el, options, meta)
|
|
2049
2058
|
}
|
|
2050
2059
|
}
|
|
2051
2060
|
|
|
2052
|
-
// RN
|
|
2053
|
-
|
|
2054
|
-
|
|
2061
|
+
// RN中裸文字需被Text包裹
|
|
2062
|
+
// 为了批量修改Text默认属性,如allowFontScaling,使用mpx-simple-text进行包裹
|
|
2063
|
+
function processWrapTextReact (el, options, meta) {
|
|
2064
|
+
const parent = el.parent
|
|
2065
|
+
const parentTag = parent.tag
|
|
2055
2066
|
if (parentTag !== 'mpx-text' && parentTag !== 'Text' && parentTag !== 'wxs') {
|
|
2056
|
-
const wrapper = createASTElement('
|
|
2067
|
+
const wrapper = createASTElement('mpx-simple-text')
|
|
2068
|
+
wrapper.isBuiltIn = true
|
|
2069
|
+
const inheritAttrs = []
|
|
2070
|
+
parent.attrsList.forEach(({ name, value }) => {
|
|
2071
|
+
if (/^data-/.test(name)) {
|
|
2072
|
+
inheritAttrs.push({
|
|
2073
|
+
name,
|
|
2074
|
+
value
|
|
2075
|
+
})
|
|
2076
|
+
}
|
|
2077
|
+
if (/^id$/.test(name)) {
|
|
2078
|
+
inheritAttrs.push({
|
|
2079
|
+
name: 'parentId',
|
|
2080
|
+
value
|
|
2081
|
+
})
|
|
2082
|
+
}
|
|
2083
|
+
})
|
|
2084
|
+
addAttrs(wrapper, inheritAttrs)
|
|
2057
2085
|
replaceNode(el, wrapper, true)
|
|
2058
2086
|
addChild(wrapper, el)
|
|
2087
|
+
processBuiltInComponents(wrapper, meta)
|
|
2088
|
+
processAttrs(wrapper, options)
|
|
2059
2089
|
}
|
|
2060
2090
|
}
|
|
2061
2091
|
|
|
@@ -2157,16 +2187,20 @@ function isRealNode (el) {
|
|
|
2157
2187
|
return !virtualNodeTagMap[el.tag]
|
|
2158
2188
|
}
|
|
2159
2189
|
|
|
2160
|
-
function isComponentNode (el
|
|
2190
|
+
function isComponentNode (el) {
|
|
2161
2191
|
return usingComponents.indexOf(el.tag) !== -1 || el.tag === 'component'
|
|
2162
2192
|
}
|
|
2163
2193
|
|
|
2164
|
-
function
|
|
2165
|
-
return
|
|
2194
|
+
function getComponentInfo (el) {
|
|
2195
|
+
return usingComponentsInfo[el.tag] || {}
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
function isReactComponent (el) {
|
|
2199
|
+
return !isComponentNode(el) && isRealNode(el) && !el.isBuiltIn
|
|
2166
2200
|
}
|
|
2167
2201
|
|
|
2168
2202
|
function processExternalClasses (el, options) {
|
|
2169
|
-
const isComponent = isComponentNode(el
|
|
2203
|
+
const isComponent = isComponentNode(el)
|
|
2170
2204
|
const classLikeAttrNames = isComponent ? ['class'].concat(options.externalClasses) : ['class']
|
|
2171
2205
|
|
|
2172
2206
|
classLikeAttrNames.forEach((classLikeAttrName) => {
|
|
@@ -2280,8 +2314,7 @@ function postProcessAliComponentRootView (el, options, meta) {
|
|
|
2280
2314
|
{ condition: /^style$/, action: 'move' },
|
|
2281
2315
|
{ condition: /^slot$/, action: 'move' }
|
|
2282
2316
|
]
|
|
2283
|
-
const
|
|
2284
|
-
const mid = options.usingComponentsInfo[tagName]?.mid || moduleId
|
|
2317
|
+
const mid = getComponentInfo(el).mid
|
|
2285
2318
|
const processAppendAttrsRules = [
|
|
2286
2319
|
{ name: 'class', value: `${MPX_ROOT_VIEW} host-${mid}` }
|
|
2287
2320
|
]
|
|
@@ -2360,12 +2393,11 @@ function getVirtualHostRoot (options, meta) {
|
|
|
2360
2393
|
{
|
|
2361
2394
|
name: 'class',
|
|
2362
2395
|
value: `${MPX_ROOT_VIEW} host-${moduleId}`
|
|
2396
|
+
},
|
|
2397
|
+
{
|
|
2398
|
+
name: 'ishost',
|
|
2399
|
+
value: '{{true}}'
|
|
2363
2400
|
}
|
|
2364
|
-
// todo 运行时通过root标识确定是否合并rootProps
|
|
2365
|
-
// {
|
|
2366
|
-
// name: 'is-root',
|
|
2367
|
-
// value: '{{true}}'
|
|
2368
|
-
// }
|
|
2369
2401
|
])
|
|
2370
2402
|
processElement(rootView, rootView, options, meta)
|
|
2371
2403
|
return rootView
|
|
@@ -2389,7 +2421,7 @@ function processShow (el, options, root) {
|
|
|
2389
2421
|
show = has ? `{{${parseMustacheWithContext(show).result}&&mpxShow}}` : '{{mpxShow}}'
|
|
2390
2422
|
}
|
|
2391
2423
|
if (show === undefined) return
|
|
2392
|
-
if (isComponentNode(el
|
|
2424
|
+
if (isComponentNode(el) && getComponentInfo(el).hasVirtualHost) {
|
|
2393
2425
|
if (show === '') {
|
|
2394
2426
|
show = '{{false}}'
|
|
2395
2427
|
}
|
|
@@ -2619,8 +2651,8 @@ function processElement (el, root, options, meta) {
|
|
|
2619
2651
|
// 预处理代码维度条件编译
|
|
2620
2652
|
processIf(el)
|
|
2621
2653
|
processFor(el)
|
|
2654
|
+
processRefReact(el, meta)
|
|
2622
2655
|
if (!pass) {
|
|
2623
|
-
processRefReact(el, meta)
|
|
2624
2656
|
processStyleReact(el, options)
|
|
2625
2657
|
processEventReact(el)
|
|
2626
2658
|
processComponentIs(el, options)
|
|
@@ -2662,7 +2694,7 @@ function processElement (el, root, options, meta) {
|
|
|
2662
2694
|
processAttrs(el, options)
|
|
2663
2695
|
}
|
|
2664
2696
|
|
|
2665
|
-
function closeElement (el,
|
|
2697
|
+
function closeElement (el, options, meta) {
|
|
2666
2698
|
postProcessAtMode(el)
|
|
2667
2699
|
postProcessWxs(el, meta)
|
|
2668
2700
|
|
|
@@ -2688,7 +2720,7 @@ function closeElement (el, meta, options) {
|
|
|
2688
2720
|
}
|
|
2689
2721
|
})
|
|
2690
2722
|
}
|
|
2691
|
-
if (isComponentNode(el
|
|
2723
|
+
if (isComponentNode(el) && !hasVirtualHost && mode === 'ali' && el.tag !== 'component') {
|
|
2692
2724
|
postProcessAliComponentRootView(el, options, meta)
|
|
2693
2725
|
}
|
|
2694
2726
|
}
|
|
@@ -19,7 +19,7 @@ function genFor (node) {
|
|
|
19
19
|
node.forProcessed = true
|
|
20
20
|
const index = node.for.index || 'index'
|
|
21
21
|
const item = node.for.item || 'item'
|
|
22
|
-
return `
|
|
22
|
+
return `this.__iter(${node.for.exp}, function(${item},${index}){return ${genNode(node)}})`
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const s = JSON.stringify
|
|
@@ -56,8 +56,8 @@ function genNode (node) {
|
|
|
56
56
|
return map
|
|
57
57
|
}, {})
|
|
58
58
|
if (node.slot) {
|
|
59
|
-
const name = node.slot
|
|
60
|
-
exp += `__getSlot(${name ? s(name) : ''})`
|
|
59
|
+
const { name, slot } = node.slot
|
|
60
|
+
exp += `this.__getSlot(${name ? s(name) : ''}${slot ? `, ${s(slot)}` : ''})`
|
|
61
61
|
} else {
|
|
62
62
|
exp += `createElement(${`getComponent(${node.is || s(node.tag)})`}`
|
|
63
63
|
if (node.attrsList.length) {
|
|
@@ -6,6 +6,7 @@ const addQuery = require('./add-query')
|
|
|
6
6
|
const resolve = require('./resolve')
|
|
7
7
|
const getJSONContent = require('./get-json-content')
|
|
8
8
|
const getRulesRunner = require('../platform')
|
|
9
|
+
const { matchCondition } = require('./match-condition')
|
|
9
10
|
const async = require('async')
|
|
10
11
|
|
|
11
12
|
module.exports = function ({
|
|
@@ -19,8 +20,7 @@ module.exports = function ({
|
|
|
19
20
|
}, callback) {
|
|
20
21
|
const mpx = loaderContext.getMpx()
|
|
21
22
|
const context = loaderContext.context
|
|
22
|
-
const mode = mpx
|
|
23
|
-
const pagesMap = mpx.pagesMap
|
|
23
|
+
const { mode, pagesMap, autoVirtualHostRules } = mpx
|
|
24
24
|
async.waterfall([
|
|
25
25
|
(callback) => {
|
|
26
26
|
getJSONContent(json, null, loaderContext, callback)
|
|
@@ -78,8 +78,8 @@ module.exports = function ({
|
|
|
78
78
|
componentGenerics = Object.assign({}, ret.componentGenerics)
|
|
79
79
|
}
|
|
80
80
|
if (usingComponents) {
|
|
81
|
-
const setUsingComponentInfo = (name,
|
|
82
|
-
usingComponentsInfo[name] =
|
|
81
|
+
const setUsingComponentInfo = (name, info) => {
|
|
82
|
+
usingComponentsInfo[name] = info
|
|
83
83
|
}
|
|
84
84
|
async.eachOf(usingComponents, (component, name, callback) => {
|
|
85
85
|
if (ctorType === 'app') {
|
|
@@ -96,7 +96,11 @@ module.exports = function ({
|
|
|
96
96
|
if (err) return callback(err)
|
|
97
97
|
const { rawResourcePath } = parseRequest(resource)
|
|
98
98
|
const moduleId = mpx.getModuleId(rawResourcePath, ctorType === 'app')
|
|
99
|
-
|
|
99
|
+
const hasVirtualHost = matchCondition(rawResourcePath, autoVirtualHostRules)
|
|
100
|
+
setUsingComponentInfo(name, {
|
|
101
|
+
mid: moduleId,
|
|
102
|
+
hasVirtualHost
|
|
103
|
+
})
|
|
100
104
|
callback()
|
|
101
105
|
})
|
|
102
106
|
}, (err) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.69-beta.0",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@better-scroll/wheel": "^2.5.1",
|
|
29
29
|
"@better-scroll/zoom": "^2.5.1",
|
|
30
30
|
"@mpxjs/template-engine": "^2.8.7",
|
|
31
|
-
"@mpxjs/utils": "^2.9.
|
|
31
|
+
"@mpxjs/utils": "^2.9.69",
|
|
32
32
|
"acorn": "^8.11.3",
|
|
33
33
|
"acorn-walk": "^7.2.0",
|
|
34
34
|
"async": "^2.6.0",
|
|
@@ -82,7 +82,8 @@
|
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@ant-design/react-native": "^5.2.2",
|
|
85
|
-
"@
|
|
85
|
+
"@d11/react-native-fast-image": "^8.6.12",
|
|
86
|
+
"@mpxjs/api-proxy": "^2.9.69",
|
|
86
87
|
"@types/babel-traverse": "^6.25.4",
|
|
87
88
|
"@types/babel-types": "^7.0.4",
|
|
88
89
|
"@types/react": "^18.2.79",
|
|
@@ -90,6 +91,7 @@
|
|
|
90
91
|
"react-native-gesture-handler": "^2.18.1",
|
|
91
92
|
"react-native-linear-gradient": "^2.8.3",
|
|
92
93
|
"react-native-reanimated": "^3.15.2",
|
|
94
|
+
"react-native-svg": "^15.8.0",
|
|
93
95
|
"react-native-safe-area-context": "^4.12.0",
|
|
94
96
|
"react-native-webview": "^13.12.2",
|
|
95
97
|
"rimraf": "^6.0.1"
|
|
@@ -97,5 +99,5 @@
|
|
|
97
99
|
"engines": {
|
|
98
100
|
"node": ">=14.14.0"
|
|
99
101
|
},
|
|
100
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "2d37697869b9bdda3efab92dda8c910b68fd05c0"
|
|
101
103
|
}
|