@mpxjs/webpack-plugin 2.7.52 → 2.7.53
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/dependencies/DynamicEntryDependency.js +18 -11
- package/lib/extractor.js +2 -1
- package/lib/index.js +2 -2
- package/lib/loader.js +6 -1
- package/lib/runtime/components/web/mpx-picker.vue +14 -8
- package/lib/template-compiler/compiler.js +6 -2
- package/lib/template-compiler/index.js +3 -1
- package/package.json +2 -2
|
@@ -73,13 +73,20 @@ class DynamicEntryDependency extends NullDependency {
|
|
|
73
73
|
resource = addQuery(resource, { packageRoot }, true)
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
const key = resource
|
|
77
|
-
let addEntryPromise
|
|
76
|
+
const key = [resource, filename].join('|')
|
|
78
77
|
|
|
79
78
|
if (alreadyOutputted) {
|
|
80
|
-
addEntryPromise = mpx.addEntryPromiseMap.get(key)
|
|
79
|
+
const addEntryPromise = mpx.addEntryPromiseMap.get(key)
|
|
80
|
+
if (addEntryPromise) {
|
|
81
|
+
addEntryPromise.then(entryModule => {
|
|
82
|
+
// 构建entry依赖图,针对alreadyOutputted的entry也需要记录
|
|
83
|
+
originEntryNode.addChild(mpx.getEntryNode(entryModule, entryType))
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
// alreadyOutputted时直接返回,避免存在模块循环引用时死循环
|
|
87
|
+
return callback(null, { resultPath })
|
|
81
88
|
} else {
|
|
82
|
-
addEntryPromise = new Promise((resolve, reject) => {
|
|
89
|
+
const addEntryPromise = new Promise((resolve, reject) => {
|
|
83
90
|
mpx.addEntry(resource, filename, (err, entryModule) => {
|
|
84
91
|
if (err) return reject(err)
|
|
85
92
|
if (entryType === 'export') {
|
|
@@ -88,15 +95,15 @@ class DynamicEntryDependency extends NullDependency {
|
|
|
88
95
|
resolve(entryModule)
|
|
89
96
|
})
|
|
90
97
|
})
|
|
98
|
+
addEntryPromise
|
|
99
|
+
.then(entryModule => {
|
|
100
|
+
originEntryNode.addChild(mpx.getEntryNode(entryModule, entryType))
|
|
101
|
+
callback(null, { resultPath })
|
|
102
|
+
})
|
|
103
|
+
.catch(err => callback(err))
|
|
104
|
+
|
|
91
105
|
mpx.addEntryPromiseMap.set(key, addEntryPromise)
|
|
92
106
|
}
|
|
93
|
-
|
|
94
|
-
addEntryPromise
|
|
95
|
-
.then(entryModule => {
|
|
96
|
-
if (entryModule) originEntryNode.addChild(mpx.getEntryNode(entryModule, entryType))
|
|
97
|
-
callback(null, { resultPath })
|
|
98
|
-
})
|
|
99
|
-
.catch(err => callback(err))
|
|
100
107
|
}
|
|
101
108
|
], callback)
|
|
102
109
|
}
|
package/lib/extractor.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -147,7 +147,7 @@ class MpxWebpackPlugin {
|
|
|
147
147
|
options.auditResource = options.auditResource || false
|
|
148
148
|
options.decodeHTMLText = options.decodeHTMLText || false
|
|
149
149
|
options.i18n = options.i18n || null
|
|
150
|
-
options.
|
|
150
|
+
options.checkUsingComponentsRules = options.checkUsingComponentsRules || (options.checkUsingComponents ? { include: () => true } : { exclude: () => true })
|
|
151
151
|
options.reportSize = options.reportSize || null
|
|
152
152
|
options.pathHashMode = options.pathHashMode || 'absolute'
|
|
153
153
|
options.forceDisableBuiltInLoader = options.forceDisableBuiltInLoader || false
|
|
@@ -566,7 +566,7 @@ class MpxWebpackPlugin {
|
|
|
566
566
|
tabBarMap: {},
|
|
567
567
|
defs: preProcessDefs(this.options.defs),
|
|
568
568
|
i18n: this.options.i18n,
|
|
569
|
-
|
|
569
|
+
checkUsingComponentsRules: this.options.checkUsingComponentsRules,
|
|
570
570
|
forceDisableBuiltInLoader: this.options.forceDisableBuiltInLoader,
|
|
571
571
|
appTitle: 'Mpx homepage',
|
|
572
572
|
attributes: this.options.attributes,
|
package/lib/loader.js
CHANGED
|
@@ -100,6 +100,7 @@ module.exports = function (content) {
|
|
|
100
100
|
const isNative = false
|
|
101
101
|
|
|
102
102
|
let usingComponents = [].concat(Object.keys(mpx.usingComponents))
|
|
103
|
+
let componentPlaceholder = []
|
|
103
104
|
|
|
104
105
|
let componentGenerics = {}
|
|
105
106
|
|
|
@@ -110,6 +111,9 @@ module.exports = function (content) {
|
|
|
110
111
|
fixUsingComponent(ret.usingComponents, mode)
|
|
111
112
|
usingComponents = usingComponents.concat(Object.keys(ret.usingComponents))
|
|
112
113
|
}
|
|
114
|
+
if (ret.componentPlaceholder) {
|
|
115
|
+
componentPlaceholder = componentPlaceholder.concat(Object.values(ret.componentPlaceholder))
|
|
116
|
+
}
|
|
113
117
|
if (ret.componentGenerics) {
|
|
114
118
|
componentGenerics = Object.assign({}, ret.componentGenerics)
|
|
115
119
|
}
|
|
@@ -279,7 +283,8 @@ module.exports = function (content) {
|
|
|
279
283
|
hasComment,
|
|
280
284
|
isNative,
|
|
281
285
|
moduleId,
|
|
282
|
-
usingComponents
|
|
286
|
+
usingComponents,
|
|
287
|
+
componentPlaceholder
|
|
283
288
|
// 添加babel处理渲染函数中可能包含的...展开运算符
|
|
284
289
|
// 由于...运算符应用范围极小以及babel成本极高,先关闭此特性后续看情况打开
|
|
285
290
|
// needBabel: true
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
<div class="wheel" v-for="(data, index) in pickerData" :key="index">
|
|
19
19
|
<ul class="wheel-scroll">
|
|
20
20
|
<li
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
v-for="item in data" :key="item"
|
|
22
|
+
class="wheel-item">{{item}}
|
|
23
23
|
</li>
|
|
24
24
|
</ul>
|
|
25
25
|
</div>
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
import { type } from './util'
|
|
40
40
|
import { getCustomEvent } from './getInnerListeners'
|
|
41
41
|
|
|
42
|
-
const startYear =
|
|
42
|
+
const startYear = 1900
|
|
43
43
|
const modeOptions = {
|
|
44
44
|
time: [23, 59],
|
|
45
|
-
date: [
|
|
45
|
+
date: [200, 11, 30]
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
BScroll.use(Wheel)
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
let months = []
|
|
74
74
|
let days = []
|
|
75
75
|
|
|
76
|
-
for (let i = 0; i <=
|
|
76
|
+
for (let i = 0; i <= 200; i++) {
|
|
77
77
|
years.push(`${startYear + i}年`)
|
|
78
78
|
}
|
|
79
79
|
if (fields === 'year') {
|
|
@@ -127,11 +127,17 @@
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
|
-
start:
|
|
131
|
-
|
|
130
|
+
start: {
|
|
131
|
+
type: String,
|
|
132
|
+
default: '1970-01-01'
|
|
133
|
+
},
|
|
134
|
+
end: {
|
|
135
|
+
type: String,
|
|
136
|
+
default: '2100-01-01'
|
|
137
|
+
},
|
|
132
138
|
fields: {
|
|
133
139
|
type: String,
|
|
134
|
-
|
|
140
|
+
default: 'day'
|
|
135
141
|
}
|
|
136
142
|
},
|
|
137
143
|
data () {
|
|
@@ -835,10 +835,14 @@ function parse (template, options) {
|
|
|
835
835
|
Array.isArray(val.errorArray) && val.errorArray.forEach(item => error$1(item))
|
|
836
836
|
})
|
|
837
837
|
|
|
838
|
-
if (!tagNames.has('component')) {
|
|
838
|
+
if (!tagNames.has('component') && options.checkUsingComponents) {
|
|
839
|
+
const arr = []
|
|
839
840
|
options.usingComponents.forEach((item) => {
|
|
840
|
-
if (!tagNames.has(item) && !options.globalComponents.includes(item) && options.
|
|
841
|
+
if (!tagNames.has(item) && !options.globalComponents.includes(item) && !options.componentPlaceholder.includes(item)) {
|
|
842
|
+
arr.push(item)
|
|
843
|
+
}
|
|
841
844
|
})
|
|
845
|
+
arr.length && warn$1(`\n ${options.filePath} \n 组件 ${arr.join(' | ')} 注册了,但是未被对应的模板引用,建议删除!`)
|
|
842
846
|
}
|
|
843
847
|
|
|
844
848
|
return {
|
|
@@ -21,6 +21,7 @@ module.exports = function (raw) {
|
|
|
21
21
|
const componentsMap = mpx.componentsMap[packageName]
|
|
22
22
|
const wxsContentMap = mpx.wxsContentMap
|
|
23
23
|
const usingComponents = queryObj.usingComponents || []
|
|
24
|
+
const componentPlaceholder = queryObj.componentPlaceholder || []
|
|
24
25
|
const hasComment = queryObj.hasComment
|
|
25
26
|
const isNative = queryObj.isNative
|
|
26
27
|
const hasScoped = queryObj.hasScoped
|
|
@@ -42,6 +43,7 @@ module.exports = function (raw) {
|
|
|
42
43
|
warn,
|
|
43
44
|
error,
|
|
44
45
|
usingComponents,
|
|
46
|
+
componentPlaceholder,
|
|
45
47
|
hasComment,
|
|
46
48
|
isNative,
|
|
47
49
|
isComponent: !!componentsMap[resourcePath],
|
|
@@ -56,7 +58,7 @@ module.exports = function (raw) {
|
|
|
56
58
|
// 这里需传递resourcePath和wxsContentMap保持一致
|
|
57
59
|
filePath: resourcePath,
|
|
58
60
|
i18n,
|
|
59
|
-
checkUsingComponents: mpx.
|
|
61
|
+
checkUsingComponents: matchCondition(resourcePath, mpx.checkUsingComponentsRules),
|
|
60
62
|
globalComponents: Object.keys(mpx.usingComponents),
|
|
61
63
|
forceProxyEvent: matchCondition(resourcePath, mpx.forceProxyEventRules),
|
|
62
64
|
hasVirtualHost: matchCondition(resourcePath, mpx.autoVirtualHostRules)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.53",
|
|
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": "33d25192ef4411be890f1af07a8b6d11557403e4"
|
|
84
84
|
}
|