@mpxjs/webpack-plugin 2.9.15 → 2.9.17
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 +9 -4
- package/lib/platform/template/wx/index.js +22 -11
- package/lib/runtime/components/web/mpx-navigator.vue +5 -0
- package/lib/runtime/components/web/mpx-textarea.vue +3 -0
- package/lib/runtime/optionProcessor.js +1 -0
- package/lib/template-compiler/compiler.js +2 -2
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -365,13 +365,18 @@ class MpxWebpackPlugin {
|
|
|
365
365
|
if (this.options.writeMode === 'changed') {
|
|
366
366
|
const writedFileContentMap = new Map()
|
|
367
367
|
const originalWriteFile = compiler.outputFileSystem.writeFile
|
|
368
|
-
|
|
368
|
+
// fs.writeFile(file, data[, options], callback)
|
|
369
|
+
compiler.outputFileSystem.writeFile = (filePath, content, ...args) => {
|
|
369
370
|
const lastContent = writedFileContentMap.get(filePath)
|
|
370
371
|
if (Buffer.isBuffer(lastContent) ? lastContent.equals(content) : lastContent === content) {
|
|
371
|
-
|
|
372
|
+
const callback = args[args.length - 1]
|
|
373
|
+
if (typeof callback === 'function') {
|
|
374
|
+
callback()
|
|
375
|
+
}
|
|
376
|
+
return
|
|
372
377
|
}
|
|
373
378
|
writedFileContentMap.set(filePath, content)
|
|
374
|
-
originalWriteFile(filePath, content,
|
|
379
|
+
originalWriteFile(filePath, content, ...args)
|
|
375
380
|
}
|
|
376
381
|
}
|
|
377
382
|
|
|
@@ -1288,7 +1293,7 @@ class MpxWebpackPlugin {
|
|
|
1288
1293
|
target = expr.object
|
|
1289
1294
|
}
|
|
1290
1295
|
|
|
1291
|
-
if (!matchCondition(resourcePath, this.options.transMpxRules) || resourcePath.indexOf('
|
|
1296
|
+
if (!matchCondition(resourcePath, this.options.transMpxRules) || resourcePath.indexOf('node_modules/@mpxjs') !== -1 || !target || mode === srcMode) return
|
|
1292
1297
|
|
|
1293
1298
|
const type = target.name
|
|
1294
1299
|
const name = type === 'wx' ? 'mpx' : 'createFactory'
|
|
@@ -201,19 +201,30 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
201
201
|
{
|
|
202
202
|
// 样式类名绑定
|
|
203
203
|
test: /^(class|wx:class)$/,
|
|
204
|
-
web ({ value }, { el }) {
|
|
205
|
-
if (el.
|
|
206
|
-
return false
|
|
207
|
-
}
|
|
204
|
+
web ({ name, value }, { el }) {
|
|
205
|
+
if (el.classMerged) return false
|
|
208
206
|
const classBinding = []
|
|
209
|
-
el.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
207
|
+
el.attrsList.filter(item => this.test.test(item.name)).forEach(({ name, value }) => {
|
|
208
|
+
const parsed = parseMustacheWithContext(value)
|
|
209
|
+
if (name === 'wx:class') {
|
|
210
|
+
classBinding.push(parsed.result)
|
|
211
|
+
} else if (name === 'class' && parsed.hasBinding === true) {
|
|
212
|
+
el.classMerged = true
|
|
213
|
+
classBinding.push(parsed.result)
|
|
214
|
+
}
|
|
213
215
|
})
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
216
|
+
|
|
217
|
+
if (el.classMerged) {
|
|
218
|
+
return {
|
|
219
|
+
name: ':class',
|
|
220
|
+
value: `[${classBinding}]`
|
|
221
|
+
}
|
|
222
|
+
} else if (name === 'wx:class') {
|
|
223
|
+
// 对于纯静态class不做合并转换
|
|
224
|
+
return {
|
|
225
|
+
name: ':class',
|
|
226
|
+
value: classBinding[0]
|
|
227
|
+
}
|
|
217
228
|
}
|
|
218
229
|
}
|
|
219
230
|
},
|
|
@@ -1715,7 +1715,7 @@ function processWebExternalClassesHack (el, options) {
|
|
|
1715
1715
|
|
|
1716
1716
|
addAttrs(el, [{
|
|
1717
1717
|
name: ':class',
|
|
1718
|
-
value: `[${replacements
|
|
1718
|
+
value: `[${replacements}]`
|
|
1719
1719
|
}])
|
|
1720
1720
|
}
|
|
1721
1721
|
}
|
|
@@ -1742,7 +1742,7 @@ function processWebExternalClassesHack (el, options) {
|
|
|
1742
1742
|
|
|
1743
1743
|
addAttrs(el, [{
|
|
1744
1744
|
name: ':' + classLikeAttrName,
|
|
1745
|
-
value: `[${replacements
|
|
1745
|
+
value: `[${replacements}].join(' ')`
|
|
1746
1746
|
}])
|
|
1747
1747
|
}
|
|
1748
1748
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.17",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"engines": {
|
|
84
84
|
"node": ">=14.14.0"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "80dd826352ab7178952f6ac1f2d7dbcf610fe6cf"
|
|
87
87
|
}
|