@mpxjs/webpack-plugin 2.9.70-alpha.0 → 2.9.70
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/LICENSE +433 -0
- package/README.md +1 -1
- package/lib/config.js +0 -14
- package/lib/dependencies/ResolveDependency.js +0 -5
- package/lib/index.js +7 -38
- package/lib/json-compiler/helper.js +3 -3
- package/lib/loader.js +0 -53
- package/lib/parser.js +1 -1
- package/lib/platform/json/wx/index.js +21 -8
- package/lib/platform/style/wx/index.js +51 -54
- package/lib/platform/template/wx/component-config/button.js +2 -14
- package/lib/platform/template/wx/component-config/fix-component-name.js +15 -12
- package/lib/platform/template/wx/component-config/image.js +0 -4
- package/lib/platform/template/wx/component-config/index.js +1 -1
- package/lib/platform/template/wx/component-config/input.js +0 -4
- package/lib/platform/template/wx/component-config/rich-text.js +6 -2
- package/lib/platform/template/wx/component-config/scroll-view.js +0 -4
- package/lib/platform/template/wx/component-config/switch.js +0 -4
- package/lib/platform/template/wx/component-config/text.js +0 -4
- package/lib/platform/template/wx/component-config/textarea.js +0 -5
- package/lib/platform/template/wx/component-config/unsupported.js +1 -1
- package/lib/platform/template/wx/component-config/view.js +0 -4
- package/lib/platform/template/wx/index.js +1 -127
- package/lib/resolve-loader.js +1 -4
- package/lib/runtime/components/react/dist/getInnerListeners.js +5 -6
- package/lib/runtime/components/react/dist/mpx-canvas/html.js +2 -4
- package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +5 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +96 -107
- package/lib/runtime/components/react/dist/mpx-picker-view.jsx +26 -27
- package/lib/runtime/components/react/dist/mpx-swiper/carouse.jsx +480 -0
- package/lib/runtime/components/react/dist/mpx-swiper/index.jsx +68 -0
- package/lib/runtime/components/react/dist/mpx-swiper/type.js +1 -0
- package/lib/runtime/components/react/dist/mpx-view.jsx +6 -3
- package/lib/runtime/components/react/dist/pickerFaces.js +6 -12
- package/lib/runtime/components/react/dist/{pickerViewOverlay.jsx → pickerOverlay.jsx} +3 -5
- package/lib/runtime/components/react/dist/useAnimationHooks.js +7 -8
- package/lib/runtime/components/react/dist/utils.jsx +89 -60
- package/lib/runtime/components/react/event.config.ts +25 -26
- package/lib/runtime/components/react/getInnerListeners.ts +212 -169
- package/lib/runtime/components/react/mpx-button.tsx +9 -14
- package/lib/runtime/components/react/mpx-canvas/html.ts +2 -4
- package/lib/runtime/components/react/mpx-canvas/index.tsx +44 -46
- package/lib/runtime/components/react/mpx-checkbox-group.tsx +15 -13
- package/lib/runtime/components/react/mpx-checkbox.tsx +20 -21
- package/lib/runtime/components/react/mpx-form.tsx +15 -20
- package/lib/runtime/components/react/mpx-icon.tsx +2 -2
- package/lib/runtime/components/react/mpx-image.tsx +87 -47
- package/lib/runtime/components/react/mpx-input.tsx +24 -32
- package/lib/runtime/components/react/mpx-label.tsx +12 -14
- package/lib/runtime/components/react/mpx-movable-area.tsx +10 -16
- package/lib/runtime/components/react/mpx-movable-view.tsx +20 -24
- package/lib/runtime/components/react/mpx-navigator.tsx +2 -8
- package/lib/runtime/components/react/mpx-radio-group.tsx +13 -15
- package/lib/runtime/components/react/mpx-radio.tsx +19 -25
- 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 +40 -41
- package/lib/runtime/components/react/mpx-switch.tsx +19 -15
- package/lib/runtime/components/react/mpx-text.tsx +8 -16
- package/lib/runtime/components/react/mpx-textarea.tsx +11 -10
- package/lib/runtime/components/react/mpx-view.tsx +18 -20
- package/lib/runtime/components/react/mpx-web-view.tsx +94 -59
- package/lib/runtime/components/react/types/global.d.ts +2 -1
- package/lib/runtime/components/react/useAnimationHooks.ts +36 -12
- package/lib/runtime/components/react/utils.tsx +91 -60
- package/lib/runtime/components/web/mpx-web-view.vue +34 -20
- package/lib/runtime/optionProcessor.js +0 -22
- package/lib/style-compiler/index.js +1 -1
- package/lib/style-compiler/plugins/scope-id.js +30 -2
- package/lib/template-compiler/compiler.js +30 -26
- package/lib/utils/env.js +1 -6
- package/lib/utils/pre-process-json.js +9 -5
- package/package.json +4 -7
- package/lib/dependencies/AddEntryDependency.js +0 -24
- package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +0 -39
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +0 -606
- package/lib/runtime/components/react/dist/pickerVIewContext.js +0 -9
- package/lib/runtime/components/react/dist/pickerViewMask.jsx +0 -18
- package/lib/runtime/components/tenon/getInnerListeners.js +0 -334
- package/lib/runtime/components/tenon/tenon-button.vue +0 -309
- package/lib/runtime/components/tenon/tenon-image.vue +0 -66
- package/lib/runtime/components/tenon/tenon-input.vue +0 -171
- package/lib/runtime/components/tenon/tenon-rich-text.vue +0 -26
- package/lib/runtime/components/tenon/tenon-scroll-view.vue +0 -127
- package/lib/runtime/components/tenon/tenon-switch.vue +0 -96
- package/lib/runtime/components/tenon/tenon-text.vue +0 -70
- package/lib/runtime/components/tenon/tenon-textarea.vue +0 -86
- package/lib/runtime/components/tenon/tenon-view.vue +0 -93
- package/lib/runtime/components/web/event.js +0 -105
- package/lib/runtime/optionProcessor.tenon.js +0 -84
- package/lib/style-compiler/plugins/hm.js +0 -20
- package/lib/tenon/index.js +0 -117
- package/lib/tenon/processJSON.js +0 -352
- package/lib/tenon/processScript.js +0 -203
- package/lib/tenon/processStyles.js +0 -21
- package/lib/tenon/processTemplate.js +0 -126
- package/lib/tenon/script-helper.js +0 -223
- package/lib/utils/get-relative-path.js +0 -25
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
<script>
|
|
6
6
|
import { getCustomEvent } from './getInnerListeners'
|
|
7
7
|
import { promisify, redirectTo, navigateTo, navigateBack, reLaunch, switchTab } from '@mpxjs/api-proxy'
|
|
8
|
-
import { extend } from '
|
|
8
|
+
import { extend, isFunction } from '@mpxjs/utils'
|
|
9
|
+
|
|
9
10
|
const navObj = promisify({ redirectTo, navigateTo, navigateBack, reLaunch, switchTab })
|
|
10
11
|
const eventLoad = 'load'
|
|
11
12
|
const eventError = 'error'
|
|
@@ -102,58 +103,71 @@ export default {
|
|
|
102
103
|
methods: {
|
|
103
104
|
messageCallback (event) {
|
|
104
105
|
const hostValidate = this.hostValidate(event.origin)
|
|
105
|
-
|
|
106
|
+
let data = {}
|
|
107
|
+
try {
|
|
108
|
+
const eventData = event.data
|
|
109
|
+
data = typeof eventData === 'string' ? JSON.parse(eventData) : eventData
|
|
110
|
+
} catch(e){}
|
|
106
111
|
// 判断number类型,防止undefined导致触发return逻辑
|
|
107
112
|
if (data.clientUid !== undefined && +data.clientUid !== this._uid) {
|
|
108
113
|
return
|
|
109
114
|
}
|
|
110
115
|
let value = data.payload
|
|
116
|
+
const args = data.args
|
|
117
|
+
const params = Array.isArray(args) ? args : [value]
|
|
111
118
|
if (!hostValidate) {
|
|
112
119
|
return
|
|
113
120
|
}
|
|
114
121
|
let asyncCallback = null
|
|
115
|
-
|
|
122
|
+
const type = data.type
|
|
123
|
+
switch (type) {
|
|
116
124
|
case 'postMessage':
|
|
117
|
-
|
|
125
|
+
let data = {
|
|
126
|
+
type: 'message',
|
|
127
|
+
data: params[0]?.data
|
|
128
|
+
}
|
|
129
|
+
this.$emit(eventMessage, getCustomEvent(eventMessage, data, this))
|
|
118
130
|
asyncCallback = Promise.resolve({
|
|
119
131
|
errMsg: 'invokeWebappApi:ok'
|
|
120
132
|
})
|
|
121
133
|
break
|
|
122
134
|
case 'navigateTo':
|
|
123
|
-
asyncCallback = navObj.navigateTo(
|
|
135
|
+
asyncCallback = navObj.navigateTo(...params)
|
|
124
136
|
break
|
|
125
137
|
case 'navigateBack':
|
|
126
|
-
asyncCallback = navObj.navigateBack(
|
|
138
|
+
asyncCallback = navObj.navigateBack(...params)
|
|
127
139
|
break
|
|
128
140
|
case 'redirectTo':
|
|
129
|
-
asyncCallback = navObj.redirectTo(
|
|
141
|
+
asyncCallback = navObj.redirectTo(...params)
|
|
130
142
|
break
|
|
131
143
|
case 'switchTab':
|
|
132
|
-
asyncCallback = navObj.switchTab(
|
|
144
|
+
asyncCallback = navObj.switchTab(...params)
|
|
133
145
|
break
|
|
134
146
|
case 'reLaunch':
|
|
135
|
-
asyncCallback = navObj.reLaunch(
|
|
147
|
+
asyncCallback = navObj.reLaunch(...params)
|
|
136
148
|
break
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
149
|
+
default:
|
|
150
|
+
if (type) {
|
|
151
|
+
const implement = mpx.config.webviewConfig.apiImplementations && mpx.config.webviewConfig.apiImplementations[type]
|
|
152
|
+
if (isFunction(implement)) {
|
|
153
|
+
asyncCallback = Promise.resolve(implement(...params))
|
|
154
|
+
} else {
|
|
155
|
+
asyncCallback = Promise.reject({
|
|
156
|
+
errMsg: `未在apiImplementations中配置${type}方法`
|
|
157
|
+
})
|
|
158
|
+
}
|
|
145
159
|
}
|
|
146
160
|
break
|
|
147
161
|
}
|
|
148
162
|
asyncCallback && asyncCallback.then((res) => {
|
|
149
163
|
this.mpxIframe && this.mpxIframe.contentWindow && this.mpxIframe.contentWindow.postMessage && this.mpxIframe.contentWindow.postMessage({
|
|
150
|
-
type:
|
|
164
|
+
type: type,
|
|
151
165
|
callbackId: data.callbackId,
|
|
152
166
|
result: res
|
|
153
167
|
}, event.origin)
|
|
154
168
|
}).catch((error) => {
|
|
155
169
|
this.mpxIframe && this.mpxIframe.contentWindow && this.mpxIframe.contentWindow.postMessage && this.mpxIframe.contentWindow.postMessage({
|
|
156
|
-
type:
|
|
170
|
+
type: type,
|
|
157
171
|
callbackId: data.callbackId,
|
|
158
172
|
error
|
|
159
173
|
}, event.origin)
|
|
@@ -183,4 +197,4 @@ export default {
|
|
|
183
197
|
right: 0;
|
|
184
198
|
bottom: 0;
|
|
185
199
|
}
|
|
186
|
-
</style>
|
|
200
|
+
</style>
|
|
@@ -2,9 +2,6 @@ import { hasOwn, isEmptyObject, extend } from './utils'
|
|
|
2
2
|
import { isBrowser } from './env'
|
|
3
3
|
import transRpxStyle from './transRpxStyle'
|
|
4
4
|
import animation from './animation'
|
|
5
|
-
import { createEvent } from './components/web/event'
|
|
6
|
-
|
|
7
|
-
createEvent()
|
|
8
5
|
|
|
9
6
|
export function processComponentOption (
|
|
10
7
|
{
|
|
@@ -309,25 +306,6 @@ function createApp ({ componentsMap, Vue, pagesMap, firstPage, VueRouter, App, t
|
|
|
309
306
|
})
|
|
310
307
|
// 处理visibilitychange时触发当前活跃页面组件的onshow/onhide
|
|
311
308
|
if (isBrowser) {
|
|
312
|
-
const errorHandler = function (args, fromVue) {
|
|
313
|
-
if (global.__mpxAppCbs && global.__mpxAppCbs.error && global.__mpxAppCbs.error.length) {
|
|
314
|
-
global.__mpxAppCbs.error.forEach((cb) => {
|
|
315
|
-
cb.apply(null, args)
|
|
316
|
-
})
|
|
317
|
-
console.error(...args)
|
|
318
|
-
} else if (fromVue) {
|
|
319
|
-
throw args[0]
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
Vue.config.errorHandler = (...args) => {
|
|
323
|
-
return errorHandler(args, true)
|
|
324
|
-
}
|
|
325
|
-
window.addEventListener('error', (event) => {
|
|
326
|
-
return errorHandler([event.error, event])
|
|
327
|
-
})
|
|
328
|
-
window.addEventListener('unhandledrejection', (event) => {
|
|
329
|
-
return errorHandler([event.reason, event])
|
|
330
|
-
})
|
|
331
309
|
document.addEventListener('visibilitychange', function () {
|
|
332
310
|
const vnode = global.__mpxRouter && global.__mpxRouter.__mpxActiveVnode
|
|
333
311
|
if (vnode && vnode.componentInstance) {
|
|
@@ -30,7 +30,7 @@ module.exports = function (css, map) {
|
|
|
30
30
|
const index = queryObj.index || 0
|
|
31
31
|
const packageName = queryObj.packageRoot || mpx.currentPackageRoot || 'main'
|
|
32
32
|
|
|
33
|
-
const transRpxFn = mpx.webConfig
|
|
33
|
+
const transRpxFn = mpx.webConfig.transRpxFn
|
|
34
34
|
const testResolveRange = (include = () => true, exclude) => {
|
|
35
35
|
return matchCondition(this.resourcePath, { include, exclude })
|
|
36
36
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const selectorParser = require('postcss-selector-parser')
|
|
2
2
|
// scope-id
|
|
3
|
-
|
|
3
|
+
function isSpaceCombinator (node) {
|
|
4
|
+
return node.type === 'combinator' && /^\s+$/.test(node.value)
|
|
5
|
+
}
|
|
4
6
|
module.exports = ({ id }) => {
|
|
5
7
|
return {
|
|
6
8
|
postcssPlugin: 'scope-id',
|
|
@@ -31,10 +33,36 @@ module.exports = ({ id }) => {
|
|
|
31
33
|
n.spaces.before = n.spaces.after = ''
|
|
32
34
|
return false
|
|
33
35
|
}
|
|
36
|
+
if (n.type === 'pseudo' && n.value === ':deep') {
|
|
37
|
+
if (n.nodes.length) {
|
|
38
|
+
let last = n
|
|
39
|
+
n.nodes[0].each((ss) => {
|
|
40
|
+
selector.insertAfter(last, ss)
|
|
41
|
+
last = ss
|
|
42
|
+
})
|
|
43
|
+
const prev = n.prev()
|
|
44
|
+
if (!prev || !isSpaceCombinator(prev)) {
|
|
45
|
+
selector.insertAfter(
|
|
46
|
+
n,
|
|
47
|
+
selectorParser.combinator({
|
|
48
|
+
value: ' '
|
|
49
|
+
})
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
n.remove()
|
|
53
|
+
} else {
|
|
54
|
+
const prev = n.prev()
|
|
55
|
+
if (prev && isSpaceCombinator(prev)) {
|
|
56
|
+
prev.remove()
|
|
57
|
+
}
|
|
58
|
+
n.remove()
|
|
59
|
+
}
|
|
60
|
+
return false
|
|
61
|
+
}
|
|
34
62
|
// /deep/ alias for >>>, since >>> doesn't work in SASS
|
|
35
63
|
if (n.type === 'tag' && n.value === '/deep/') {
|
|
36
64
|
const prev = n.prev()
|
|
37
|
-
if (prev && prev
|
|
65
|
+
if (prev && isSpaceCombinator(prev)) {
|
|
38
66
|
prev.remove()
|
|
39
67
|
}
|
|
40
68
|
n.remove()
|
|
@@ -15,7 +15,7 @@ const { isNonPhrasingTag } = require('../utils/dom-tag-config')
|
|
|
15
15
|
const setBaseWxml = require('../runtime-render/base-wxml')
|
|
16
16
|
const { parseExp } = require('./parse-exps')
|
|
17
17
|
const shallowStringify = require('../utils/shallow-stringify')
|
|
18
|
-
const { isReact, isWeb
|
|
18
|
+
const { isReact, isWeb } = require('../utils/env')
|
|
19
19
|
|
|
20
20
|
const no = function () {
|
|
21
21
|
return false
|
|
@@ -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, {
|
|
@@ -1227,7 +1229,8 @@ function processEventReact (el) {
|
|
|
1227
1229
|
])
|
|
1228
1230
|
} else {
|
|
1229
1231
|
const { name, value } = configs[0]
|
|
1230
|
-
|
|
1232
|
+
const { result } = parseMustacheWithContext(value)
|
|
1233
|
+
modifyAttr(el, name, `{{this[${result}]}}`)
|
|
1231
1234
|
}
|
|
1232
1235
|
|
|
1233
1236
|
// 非button的情况下,press/longPress时间需要包裹TouchableWithoutFeedback进行响应,后续可支持配置
|
|
@@ -1927,7 +1930,7 @@ function postProcessFor (el) {
|
|
|
1927
1930
|
function postProcessForReact (el) {
|
|
1928
1931
|
if (el.for) {
|
|
1929
1932
|
if (el.for.key) {
|
|
1930
|
-
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')
|
|
1931
1934
|
addAttrs(el, [{
|
|
1932
1935
|
name: 'key',
|
|
1933
1936
|
value: el.for.key
|
|
@@ -2063,16 +2066,22 @@ function processWrapTextReact (el, options, meta) {
|
|
|
2063
2066
|
if (parentTag !== 'mpx-text' && parentTag !== 'Text' && parentTag !== 'wxs') {
|
|
2064
2067
|
const wrapper = createASTElement('mpx-simple-text')
|
|
2065
2068
|
wrapper.isBuiltIn = true
|
|
2066
|
-
const
|
|
2069
|
+
const inheritAttrs = []
|
|
2067
2070
|
parent.attrsList.forEach(({ name, value }) => {
|
|
2068
2071
|
if (/^data-/.test(name)) {
|
|
2069
|
-
|
|
2072
|
+
inheritAttrs.push({
|
|
2070
2073
|
name,
|
|
2071
2074
|
value
|
|
2072
2075
|
})
|
|
2073
2076
|
}
|
|
2077
|
+
if (/^id$/.test(name)) {
|
|
2078
|
+
inheritAttrs.push({
|
|
2079
|
+
name: 'parentId',
|
|
2080
|
+
value
|
|
2081
|
+
})
|
|
2082
|
+
}
|
|
2074
2083
|
})
|
|
2075
|
-
addAttrs(wrapper,
|
|
2084
|
+
addAttrs(wrapper, inheritAttrs)
|
|
2076
2085
|
replaceNode(el, wrapper, true)
|
|
2077
2086
|
addChild(wrapper, el)
|
|
2078
2087
|
processBuiltInComponents(wrapper, meta)
|
|
@@ -2094,7 +2103,7 @@ function processWrapTextReact (el, options, meta) {
|
|
|
2094
2103
|
// }
|
|
2095
2104
|
|
|
2096
2105
|
function injectWxs (meta, module, src) {
|
|
2097
|
-
if (runtimeCompile || addWxsModule(meta, module, src) || isReact(mode) || isWeb(mode)
|
|
2106
|
+
if (runtimeCompile || addWxsModule(meta, module, src) || isReact(mode) || isWeb(mode)) {
|
|
2098
2107
|
return
|
|
2099
2108
|
}
|
|
2100
2109
|
|
|
@@ -2178,16 +2187,20 @@ function isRealNode (el) {
|
|
|
2178
2187
|
return !virtualNodeTagMap[el.tag]
|
|
2179
2188
|
}
|
|
2180
2189
|
|
|
2181
|
-
function isComponentNode (el
|
|
2190
|
+
function isComponentNode (el) {
|
|
2182
2191
|
return usingComponents.indexOf(el.tag) !== -1 || el.tag === 'component'
|
|
2183
2192
|
}
|
|
2184
2193
|
|
|
2185
|
-
function
|
|
2186
|
-
return
|
|
2194
|
+
function getComponentInfo (el) {
|
|
2195
|
+
return usingComponentsInfo[el.tag] || {}
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
function isReactComponent (el) {
|
|
2199
|
+
return !isComponentNode(el) && isRealNode(el) && !el.isBuiltIn
|
|
2187
2200
|
}
|
|
2188
2201
|
|
|
2189
2202
|
function processExternalClasses (el, options) {
|
|
2190
|
-
const isComponent = isComponentNode(el
|
|
2203
|
+
const isComponent = isComponentNode(el)
|
|
2191
2204
|
const classLikeAttrNames = isComponent ? ['class'].concat(options.externalClasses) : ['class']
|
|
2192
2205
|
|
|
2193
2206
|
classLikeAttrNames.forEach((classLikeAttrName) => {
|
|
@@ -2301,8 +2314,7 @@ function postProcessAliComponentRootView (el, options, meta) {
|
|
|
2301
2314
|
{ condition: /^style$/, action: 'move' },
|
|
2302
2315
|
{ condition: /^slot$/, action: 'move' }
|
|
2303
2316
|
]
|
|
2304
|
-
const
|
|
2305
|
-
const mid = options.usingComponentsInfo[tagName]?.mid || moduleId
|
|
2317
|
+
const mid = getComponentInfo(el).mid
|
|
2306
2318
|
const processAppendAttrsRules = [
|
|
2307
2319
|
{ name: 'class', value: `${MPX_ROOT_VIEW} host-${mid}` }
|
|
2308
2320
|
]
|
|
@@ -2409,7 +2421,7 @@ function processShow (el, options, root) {
|
|
|
2409
2421
|
show = has ? `{{${parseMustacheWithContext(show).result}&&mpxShow}}` : '{{mpxShow}}'
|
|
2410
2422
|
}
|
|
2411
2423
|
if (show === undefined) return
|
|
2412
|
-
if (isComponentNode(el
|
|
2424
|
+
if (isComponentNode(el) && getComponentInfo(el).hasVirtualHost) {
|
|
2413
2425
|
if (show === '') {
|
|
2414
2426
|
show = '{{false}}'
|
|
2415
2427
|
}
|
|
@@ -2631,15 +2643,6 @@ function processElement (el, root, options, meta) {
|
|
|
2631
2643
|
processComponentGenericsWeb(el, options, meta)
|
|
2632
2644
|
return
|
|
2633
2645
|
}
|
|
2634
|
-
if (mode === 'tenon') {
|
|
2635
|
-
// 收集内建组件
|
|
2636
|
-
processBuiltInComponents(el, meta)
|
|
2637
|
-
// 预处理代码维度条件编译
|
|
2638
|
-
processIfWeb(el)
|
|
2639
|
-
// processWebExternalClassesHack(el, options)
|
|
2640
|
-
// processComponentGenericsForWeb(el, options, meta)
|
|
2641
|
-
return
|
|
2642
|
-
}
|
|
2643
2646
|
|
|
2644
2647
|
if (isReact(mode)) {
|
|
2645
2648
|
const pass = isReactComponent(el, options)
|
|
@@ -2695,7 +2698,7 @@ function closeElement (el, options, meta) {
|
|
|
2695
2698
|
postProcessAtMode(el)
|
|
2696
2699
|
postProcessWxs(el, meta)
|
|
2697
2700
|
|
|
2698
|
-
if (isWeb(mode)
|
|
2701
|
+
if (isWeb(mode)) {
|
|
2699
2702
|
// 处理代码维度条件编译移除死分支
|
|
2700
2703
|
postProcessIf(el)
|
|
2701
2704
|
return
|
|
@@ -2710,14 +2713,14 @@ function closeElement (el, options, meta) {
|
|
|
2710
2713
|
if (!isTemplate) {
|
|
2711
2714
|
if (!isNative) {
|
|
2712
2715
|
postProcessComponentIs(el, (child) => {
|
|
2713
|
-
if (!hasVirtualHost && mode === 'ali') {
|
|
2716
|
+
if (!getComponentInfo(el).hasVirtualHost && mode === 'ali') {
|
|
2714
2717
|
postProcessAliComponentRootView(child, options)
|
|
2715
2718
|
} else {
|
|
2716
2719
|
postProcessIf(child)
|
|
2717
2720
|
}
|
|
2718
2721
|
})
|
|
2719
2722
|
}
|
|
2720
|
-
if (isComponentNode(el
|
|
2723
|
+
if (isComponentNode(el) && !getComponentInfo(el).hasVirtualHost && mode === 'ali' && el.tag !== 'component') {
|
|
2721
2724
|
postProcessAliComponentRootView(el, options, meta)
|
|
2722
2725
|
}
|
|
2723
2726
|
}
|
|
@@ -2828,6 +2831,7 @@ function serialize (root) {
|
|
|
2828
2831
|
result += node.text
|
|
2829
2832
|
}
|
|
2830
2833
|
}
|
|
2834
|
+
|
|
2831
2835
|
if (node.type === 1) {
|
|
2832
2836
|
if (node.tag !== 'temp-node') {
|
|
2833
2837
|
result += '<' + node.tag
|
package/lib/utils/env.js
CHANGED
|
@@ -6,17 +6,12 @@ function isWeb (mode) {
|
|
|
6
6
|
return mode === 'web'
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
function isTenon (mode) {
|
|
10
|
-
return mode === 'tenon'
|
|
11
|
-
}
|
|
12
|
-
|
|
13
9
|
function isMiniProgram (mode) {
|
|
14
|
-
return !isWeb(mode) && !isReact(mode)
|
|
10
|
+
return !isWeb(mode) && !isReact(mode)
|
|
15
11
|
}
|
|
16
12
|
|
|
17
13
|
module.exports = {
|
|
18
14
|
isWeb,
|
|
19
15
|
isReact,
|
|
20
|
-
isTenon,
|
|
21
16
|
isMiniProgram
|
|
22
17
|
}
|
|
@@ -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.70
|
|
3
|
+
"version": "2.9.70",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -27,11 +27,8 @@
|
|
|
27
27
|
"@better-scroll/slide": "^2.5.1",
|
|
28
28
|
"@better-scroll/wheel": "^2.5.1",
|
|
29
29
|
"@better-scroll/zoom": "^2.5.1",
|
|
30
|
-
"@hummer/tenon-dev-server-webpack-plugin": "0.0.2",
|
|
31
|
-
"@hummer/tenon-loader": "^1.2.0",
|
|
32
|
-
"@hummer/tenon-style-loader": "^0.2.0",
|
|
33
30
|
"@mpxjs/template-engine": "^2.8.7",
|
|
34
|
-
"@mpxjs/utils": "
|
|
31
|
+
"@mpxjs/utils": "^2.9.70",
|
|
35
32
|
"acorn": "^8.11.3",
|
|
36
33
|
"acorn-walk": "^7.2.0",
|
|
37
34
|
"async": "^2.6.0",
|
|
@@ -86,7 +83,7 @@
|
|
|
86
83
|
"devDependencies": {
|
|
87
84
|
"@ant-design/react-native": "^5.2.2",
|
|
88
85
|
"@d11/react-native-fast-image": "^8.6.12",
|
|
89
|
-
"@mpxjs/api-proxy": "^2.9.
|
|
86
|
+
"@mpxjs/api-proxy": "^2.9.70",
|
|
90
87
|
"@types/babel-traverse": "^6.25.4",
|
|
91
88
|
"@types/babel-types": "^7.0.4",
|
|
92
89
|
"@types/react": "^18.2.79",
|
|
@@ -102,5 +99,5 @@
|
|
|
102
99
|
"engines": {
|
|
103
100
|
"node": ">=14.14.0"
|
|
104
101
|
},
|
|
105
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "ad8f04de95865ffc2b50b8c0a7f87b5952fb8647"
|
|
106
103
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const NullDependency = require('webpack/lib/dependencies/NullDependency')
|
|
2
|
-
|
|
3
|
-
class AddEntryDependency extends NullDependency {
|
|
4
|
-
constructor ({ context, dep, name }) {
|
|
5
|
-
super()
|
|
6
|
-
this.__addEntryParams = [context, dep, name]
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
get type () {
|
|
10
|
-
return 'mpx add entry'
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// updateHash (hash) {
|
|
14
|
-
// super.updateHash(hash)
|
|
15
|
-
// hash.update(this.childCompileEntryModule.identifier())
|
|
16
|
-
// }
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
AddEntryDependency.Template = class AddEntryDependencyTemplate {
|
|
20
|
-
apply () {
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
module.exports = AddEntryDependency
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import Reanimated, { Extrapolation, interpolate, useAnimatedStyle, useSharedValue } from 'react-native-reanimated';
|
|
3
|
-
import { wrapChildren, extendObject } from './utils';
|
|
4
|
-
import { createFaces } from './pickerFaces';
|
|
5
|
-
import { usePickerViewColumnAnimationContext } from './pickerVIewContext';
|
|
6
|
-
const _PickerViewColumnItem = ({ item, index, itemHeight, itemWidth, textStyleFromParent, textStyle, hasVarDec, varContext, textProps, visibleCount, onItemLayout }) => {
|
|
7
|
-
const offsetYShared = usePickerViewColumnAnimationContext();
|
|
8
|
-
const facesShared = useSharedValue(createFaces(itemHeight, visibleCount));
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
facesShared.value = createFaces(itemHeight, visibleCount);
|
|
11
|
-
}, [itemHeight]);
|
|
12
|
-
const animatedStyles = useAnimatedStyle(() => {
|
|
13
|
-
const inputRange = facesShared.value.map((f) => itemHeight * (index + f.index));
|
|
14
|
-
return {
|
|
15
|
-
opacity: interpolate(offsetYShared.value, inputRange, facesShared.value.map((x) => x.opacity), Extrapolation.CLAMP),
|
|
16
|
-
transform: [
|
|
17
|
-
{ rotateX: interpolate(offsetYShared.value, inputRange, facesShared.value.map((x) => x.deg), Extrapolation.CLAMP) + 'deg' },
|
|
18
|
-
{ translateY: interpolate(offsetYShared.value, inputRange, facesShared.value.map((x) => x.offsetY), Extrapolation.EXTEND) },
|
|
19
|
-
{ scale: interpolate(offsetYShared.value, inputRange, facesShared.value.map((x) => x.scale), Extrapolation.EXTEND) }
|
|
20
|
-
]
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
const strKey = `picker-column-item-${index}`;
|
|
24
|
-
const restProps = index === 0 ? { onLayout: onItemLayout } : {};
|
|
25
|
-
const itemProps = extendObject({
|
|
26
|
-
style: extendObject({ height: itemHeight, width: '100%' }, textStyleFromParent, textStyle, item.props.style)
|
|
27
|
-
}, restProps);
|
|
28
|
-
const realItem = React.cloneElement(item, itemProps);
|
|
29
|
-
return (<Reanimated.View key={strKey} style={[{ height: itemHeight, width: itemWidth }, animatedStyles]}>
|
|
30
|
-
{wrapChildren({ children: realItem }, {
|
|
31
|
-
hasVarDec,
|
|
32
|
-
varContext,
|
|
33
|
-
textStyle,
|
|
34
|
-
textProps
|
|
35
|
-
})}
|
|
36
|
-
</Reanimated.View>);
|
|
37
|
-
};
|
|
38
|
-
_PickerViewColumnItem.displayName = 'MpxPickerViewColumnItem';
|
|
39
|
-
export default _PickerViewColumnItem;
|