@mpxjs/webpack-plugin 2.8.45 → 2.8.46
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.
|
@@ -195,7 +195,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
195
195
|
const parsed = parseMustache(item.value)
|
|
196
196
|
if (item.name === 'wx:style') {
|
|
197
197
|
styleBinding.push(parsed.result)
|
|
198
|
-
|
|
198
|
+
// item.name === 'style'
|
|
199
199
|
} else if (parsed.hasBinding || parsed.result.indexOf('rpx') > -1) {
|
|
200
200
|
styleBinding.push(parsed.result)
|
|
201
201
|
} else {
|
|
@@ -295,18 +295,39 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
295
295
|
},
|
|
296
296
|
swan ({ name, value }, { eventRules }) {
|
|
297
297
|
const match = this.test.exec(name)
|
|
298
|
+
const prefix = match[1]
|
|
298
299
|
const eventName = match[2]
|
|
299
|
-
|
|
300
|
+
const modifierStr = match[3] || ''
|
|
301
|
+
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'swan' })
|
|
302
|
+
const rEventName = runRules(eventRules, eventName, { mode: 'swan' })
|
|
303
|
+
return {
|
|
304
|
+
name: rPrefix + rEventName + modifierStr,
|
|
305
|
+
value
|
|
306
|
+
}
|
|
300
307
|
},
|
|
301
308
|
qq ({ name, value }, { eventRules }) {
|
|
302
309
|
const match = this.test.exec(name)
|
|
310
|
+
const prefix = match[1]
|
|
303
311
|
const eventName = match[2]
|
|
304
|
-
|
|
312
|
+
const modifierStr = match[3] || ''
|
|
313
|
+
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'qq' })
|
|
314
|
+
const rEventName = runRules(eventRules, eventName, { mode: 'qq' })
|
|
315
|
+
return {
|
|
316
|
+
name: rPrefix + rEventName + modifierStr,
|
|
317
|
+
value
|
|
318
|
+
}
|
|
305
319
|
},
|
|
306
320
|
jd ({ name, value }, { eventRules }) {
|
|
307
321
|
const match = this.test.exec(name)
|
|
322
|
+
const prefix = match[1]
|
|
308
323
|
const eventName = match[2]
|
|
309
|
-
|
|
324
|
+
const modifierStr = match[3] || ''
|
|
325
|
+
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'jd' })
|
|
326
|
+
const rEventName = runRules(eventRules, eventName, { mode: 'jd' })
|
|
327
|
+
return {
|
|
328
|
+
name: rPrefix + rEventName + modifierStr,
|
|
329
|
+
value
|
|
330
|
+
}
|
|
310
331
|
},
|
|
311
332
|
// tt ({ name, value }, { eventRules }) {
|
|
312
333
|
// const match = this.test.exec(name)
|
|
@@ -322,15 +343,33 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
322
343
|
// },
|
|
323
344
|
tt ({ name, value }, { eventRules }) {
|
|
324
345
|
const match = this.test.exec(name)
|
|
346
|
+
const prefix = match[1]
|
|
325
347
|
const eventName = match[2]
|
|
326
|
-
|
|
348
|
+
const modifierStr = match[3] || ''
|
|
349
|
+
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'tt' })
|
|
350
|
+
const rEventName = runRules(eventRules, eventName, { mode: 'tt' })
|
|
351
|
+
return {
|
|
352
|
+
name: rPrefix + rEventName + modifierStr,
|
|
353
|
+
value
|
|
354
|
+
}
|
|
327
355
|
},
|
|
328
356
|
dd ({ name, value }, { eventRules }) {
|
|
329
357
|
const match = this.test.exec(name)
|
|
358
|
+
const prefix = match[1]
|
|
330
359
|
const eventName = match[2]
|
|
331
|
-
|
|
360
|
+
const modifierStr = match[3] || ''
|
|
361
|
+
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'dd' })
|
|
362
|
+
const rEventName = runRules(eventRules, eventName, { mode: 'dd' })
|
|
363
|
+
return {
|
|
364
|
+
name: rPrefix + rEventName + modifierStr,
|
|
365
|
+
value
|
|
366
|
+
}
|
|
332
367
|
},
|
|
333
368
|
web ({ name, value }, { eventRules, el }) {
|
|
369
|
+
if (parseMustache(value).hasBinding) {
|
|
370
|
+
error('Web environment does not support mustache binding in event props!')
|
|
371
|
+
return
|
|
372
|
+
}
|
|
334
373
|
const match = this.test.exec(name)
|
|
335
374
|
const prefix = match[1]
|
|
336
375
|
const eventName = match[2]
|
|
@@ -30,9 +30,7 @@
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function getVnodeKey (vnode) {
|
|
33
|
-
|
|
34
|
-
return vnode.componentOptions.Ctor.cid + (vnode.componentOptions.tag ? ('::' + (vnode.componentOptions.tag)) : '')
|
|
35
|
-
}
|
|
33
|
+
return vnode.tag + (vnode.key ? `::${vnode.key}` : '')
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
export default {
|
|
@@ -44,12 +42,13 @@
|
|
|
44
42
|
if (!isBrowser) {
|
|
45
43
|
return vnode || (slot && slot[0])
|
|
46
44
|
}
|
|
47
|
-
const vnodeKey = getVnodeKey(vnode)
|
|
48
45
|
const router = global.__mpxRouter
|
|
49
|
-
if (
|
|
46
|
+
if (router) {
|
|
47
|
+
// 存在routeCount的情况下修改vnode.key避免patch时复用旧节点实例
|
|
48
|
+
if (router.currentRoute.query.routeCount) vnode.key = router.currentRoute.query.routeCount
|
|
49
|
+
const vnodeKey = getVnodeKey(vnode)
|
|
50
50
|
if (router.needCache) {
|
|
51
51
|
router.needCache.vnode = vnode
|
|
52
|
-
router.needCache.vnodeKey = vnodeKey
|
|
53
52
|
router.needCache = null
|
|
54
53
|
}
|
|
55
54
|
|
|
@@ -69,25 +68,17 @@
|
|
|
69
68
|
|
|
70
69
|
const stack = router.stack
|
|
71
70
|
if (stack.length) {
|
|
72
|
-
//
|
|
71
|
+
// 只要历史栈缓存中存在对应的页面存活实例且vnodeKey相同,就进行复用
|
|
73
72
|
for (let i = stack.length; i > 0; i--) {
|
|
74
73
|
const current = stack[i - 1]
|
|
75
|
-
if (current.vnode && current.
|
|
74
|
+
if (current.vnode && getVnodeKey(current.vnode) === vnodeKey && current.vnode.componentInstance) {
|
|
76
75
|
vnode.componentInstance = current.vnode.componentInstance
|
|
77
|
-
// 避免组件实例复用但是vnode.key不一致带来的bad case
|
|
78
|
-
vnode.key = current.vnode.key
|
|
79
76
|
break
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
79
|
}
|
|
83
80
|
|
|
84
|
-
if (router.__mpxAction)
|
|
85
|
-
if (router.__mpxAction.type === 'reLaunch') {
|
|
86
|
-
// reLaunch时修改新vnode的key, 确保任何情况下都新创建组件实例
|
|
87
|
-
vnode.key = (vnode.key || '') + router.__mpxAction.reLaunchCount
|
|
88
|
-
}
|
|
89
|
-
router.__mpxAction = null
|
|
90
|
-
}
|
|
81
|
+
if (router.__mpxAction) router.__mpxAction = null
|
|
91
82
|
vnode.data.keepAlive = true
|
|
92
83
|
}
|
|
93
84
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.46",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"engines": {
|
|
83
83
|
"node": ">=14.14.0"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "dcf6f000660d56207ff414cb776e8bc6d5ce651f"
|
|
86
86
|
}
|