@mpxjs/webpack-plugin 2.8.28-beta.1 → 2.8.28
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 +16 -11
- package/lib/index.js +10 -21
- package/lib/json-compiler/index.js +1 -8
- package/lib/platform/template/wx/component-config/component.js +2 -1
- package/lib/platform/template/wx/index.js +13 -11
- package/lib/template-compiler/compiler.js +49 -72
- package/lib/utils/fix-swan-relative.js +6 -0
- package/lib/wxss/loader.js +3 -3
- package/package.json +10 -10
|
@@ -28,10 +28,23 @@ class DynamicEntryDependency extends NullDependency {
|
|
|
28
28
|
return toPosix([request, entryType, outputPath, packageRoot, relativePath, context, ...range].join('|'))
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
collectDynamicRequest (mpx) {
|
|
32
|
+
if (!this.packageRoot) return
|
|
33
|
+
const curValue = mpx.dynamicEntryInfo[this.packageRoot] = mpx.dynamicEntryInfo[this.packageRoot] || {
|
|
34
|
+
hasPage: false,
|
|
35
|
+
entries: []
|
|
36
|
+
}
|
|
37
|
+
if (this.entryType === 'page') {
|
|
38
|
+
curValue.hasPage = true
|
|
39
|
+
} else {
|
|
40
|
+
curValue.entries.push(this.request)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
31
44
|
addEntry (compilation, callback) {
|
|
32
45
|
const mpx = compilation.__mpx__
|
|
33
46
|
let { request, entryType, outputPath, relativePath, context, originEntryNode, publicPath, resolver } = this
|
|
34
|
-
|
|
47
|
+
this.collectDynamicRequest(mpx)
|
|
35
48
|
async.waterfall([
|
|
36
49
|
(callback) => {
|
|
37
50
|
if (context && resolver) {
|
|
@@ -43,13 +56,12 @@ class DynamicEntryDependency extends NullDependency {
|
|
|
43
56
|
}
|
|
44
57
|
},
|
|
45
58
|
(resource, callback) => {
|
|
46
|
-
const { resourcePath } = parseRequest(resource)
|
|
47
|
-
|
|
48
59
|
if (!outputPath) {
|
|
60
|
+
const { resourcePath } = parseRequest(resource)
|
|
49
61
|
outputPath = mpx.getOutputPath(resourcePath, entryType)
|
|
50
62
|
}
|
|
51
63
|
|
|
52
|
-
const {
|
|
64
|
+
const { packageRoot, outputPath: filename, alreadyOutputted } = mpx.getPackageInfo({
|
|
53
65
|
resource,
|
|
54
66
|
outputPath,
|
|
55
67
|
resourceType: entryType,
|
|
@@ -76,13 +88,6 @@ class DynamicEntryDependency extends NullDependency {
|
|
|
76
88
|
|
|
77
89
|
const key = [resource, filename].join('|')
|
|
78
90
|
|
|
79
|
-
mpx.collectDynamicEntryInfo({
|
|
80
|
-
resource,
|
|
81
|
-
packageName,
|
|
82
|
-
filename,
|
|
83
|
-
entryType
|
|
84
|
-
})
|
|
85
|
-
|
|
86
91
|
if (alreadyOutputted) {
|
|
87
92
|
const addEntryPromise = mpx.addEntryPromiseMap.get(key)
|
|
88
93
|
if (addEntryPromise) {
|
package/lib/index.js
CHANGED
|
@@ -454,17 +454,17 @@ class MpxWebpackPlugin {
|
|
|
454
454
|
stage: -1000
|
|
455
455
|
}, (compilation, callback) => {
|
|
456
456
|
processSubpackagesEntriesMap(compilation, () => {
|
|
457
|
-
const
|
|
458
|
-
for (const
|
|
459
|
-
const entryMap = mpx.dynamicEntryInfo[
|
|
460
|
-
if (
|
|
457
|
+
const checkRegisterPack = () => {
|
|
458
|
+
for (const packRoot in mpx.dynamicEntryInfo) {
|
|
459
|
+
const entryMap = mpx.dynamicEntryInfo[packRoot]
|
|
460
|
+
if (!entryMap.hasPage) {
|
|
461
461
|
// 引用未注册分包的所有资源
|
|
462
|
-
const
|
|
463
|
-
compilation.errors.push(new Error(`资源${
|
|
462
|
+
const strRequest = entryMap.entries.join(',')
|
|
463
|
+
compilation.errors.push(new Error(`资源${strRequest}目标是打入${packRoot}分包, 但是app.json中并未声明${packRoot}分包`))
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
|
|
467
|
+
checkRegisterPack()
|
|
468
468
|
callback()
|
|
469
469
|
})
|
|
470
470
|
})
|
|
@@ -524,6 +524,7 @@ class MpxWebpackPlugin {
|
|
|
524
524
|
compilation.warnings = compilation.warnings.concat(warnings)
|
|
525
525
|
compilation.errors = compilation.errors.concat(errors)
|
|
526
526
|
const moduleGraph = compilation.moduleGraph
|
|
527
|
+
|
|
527
528
|
if (!compilation.__mpx__) {
|
|
528
529
|
// init mpx
|
|
529
530
|
mpx = compilation.__mpx__ = {
|
|
@@ -550,7 +551,7 @@ class MpxWebpackPlugin {
|
|
|
550
551
|
subpackagesEntriesMap: {},
|
|
551
552
|
replacePathMap: {},
|
|
552
553
|
exportModules: new Set(),
|
|
553
|
-
//
|
|
554
|
+
// 动态记录注册的分包与注册页面映射
|
|
554
555
|
dynamicEntryInfo: {},
|
|
555
556
|
// 记录entryModule与entryNode的对应关系,用于体积分析
|
|
556
557
|
entryNodeModulesMap: new Map(),
|
|
@@ -593,25 +594,13 @@ class MpxWebpackPlugin {
|
|
|
593
594
|
removedChunks: [],
|
|
594
595
|
forceProxyEventRules: this.options.forceProxyEventRules,
|
|
595
596
|
enableAliRequireAsync: this.options.enableAliRequireAsync,
|
|
596
|
-
collectDynamicEntryInfo: ({ resource, packageName, filename, entryType }) => {
|
|
597
|
-
const curInfo = mpx.dynamicEntryInfo[packageName] = mpx.dynamicEntryInfo[packageName] || {
|
|
598
|
-
hasPage: false,
|
|
599
|
-
entries: []
|
|
600
|
-
}
|
|
601
|
-
if (entryType === 'page') curInfo.hasPage = true
|
|
602
|
-
curInfo.entries.push({
|
|
603
|
-
entryType,
|
|
604
|
-
resource,
|
|
605
|
-
filename
|
|
606
|
-
})
|
|
607
|
-
},
|
|
608
597
|
pathHash: (resourcePath) => {
|
|
609
598
|
if (this.options.pathHashMode === 'relative' && this.options.projectRoot) {
|
|
610
599
|
return hash(path.relative(this.options.projectRoot, resourcePath))
|
|
611
600
|
}
|
|
612
601
|
return hash(resourcePath)
|
|
613
602
|
},
|
|
614
|
-
addEntry
|
|
603
|
+
addEntry (request, name, callback) {
|
|
615
604
|
const dep = EntryPlugin.createDependency(request, { name })
|
|
616
605
|
compilation.addEntry(compiler.context, dep, { name }, callback)
|
|
617
606
|
return dep
|
|
@@ -98,14 +98,7 @@ module.exports = function (content) {
|
|
|
98
98
|
if (err) return callback(err)
|
|
99
99
|
if (!this._compilation) return callback()
|
|
100
100
|
const targetPath = path.relative(context, file)
|
|
101
|
-
this.
|
|
102
|
-
size: function size () {
|
|
103
|
-
return stats.size
|
|
104
|
-
},
|
|
105
|
-
source: function source () {
|
|
106
|
-
return content
|
|
107
|
-
}
|
|
108
|
-
}
|
|
101
|
+
this.emitFile(targetPath, content)
|
|
109
102
|
callback()
|
|
110
103
|
})
|
|
111
104
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const
|
|
1
|
+
const templateCompiler = require('../../../../template-compiler/compiler')
|
|
2
|
+
const parseMustache = templateCompiler.parseMustache
|
|
2
3
|
const normalize = require('../../../../utils/normalize')
|
|
3
4
|
const TAG_NAME = 'component'
|
|
4
5
|
|
|
@@ -3,7 +3,9 @@ const JSON5 = require('json5')
|
|
|
3
3
|
const getComponentConfigs = require('./component-config')
|
|
4
4
|
const normalizeComponentRules = require('../normalize-component-rules')
|
|
5
5
|
const isValidIdentifierStr = require('../../../utils/is-valid-identifier-str')
|
|
6
|
-
const
|
|
6
|
+
const templateCompiler = require('../../../template-compiler/compiler')
|
|
7
|
+
const parseMustache = templateCompiler.parseMustache
|
|
8
|
+
const stringifyWithResolveComputed = templateCompiler.stringifyWithResolveComputed
|
|
7
9
|
const normalize = require('../../../utils/normalize')
|
|
8
10
|
|
|
9
11
|
module.exports = function getSpec ({ warn, error }) {
|
|
@@ -15,10 +17,10 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
15
17
|
postProps: [
|
|
16
18
|
{
|
|
17
19
|
web ({ name, value }) {
|
|
18
|
-
const parsed =
|
|
20
|
+
const parsed = parseMustache(value)
|
|
19
21
|
if (parsed.hasBinding) {
|
|
20
22
|
return {
|
|
21
|
-
name: name === 'animation' ? 'v-
|
|
23
|
+
name: name === 'animation' ? 'v-' + name : ':' + name,
|
|
22
24
|
value: parsed.result
|
|
23
25
|
}
|
|
24
26
|
}
|
|
@@ -32,7 +34,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
32
34
|
test: 'wx:for',
|
|
33
35
|
swan (obj, data) {
|
|
34
36
|
const attrsMap = data.el.attrsMap
|
|
35
|
-
const parsed =
|
|
37
|
+
const parsed = parseMustache(obj.value)
|
|
36
38
|
let listName = parsed.result
|
|
37
39
|
const el = data.el
|
|
38
40
|
|
|
@@ -46,7 +48,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
if (keyName) {
|
|
49
|
-
const parsed =
|
|
51
|
+
const parsed = parseMustache(keyName)
|
|
50
52
|
if (parsed.hasBinding) {
|
|
51
53
|
// keyStr = ` trackBy ${parsed.result.slice(1, -1)}`
|
|
52
54
|
} else if (keyName === '*this') {
|
|
@@ -76,7 +78,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
76
78
|
}
|
|
77
79
|
},
|
|
78
80
|
web ({ value }, { el }) {
|
|
79
|
-
const parsed =
|
|
81
|
+
const parsed = parseMustache(value)
|
|
80
82
|
const attrsMap = el.attrsMap
|
|
81
83
|
const itemName = attrsMap['wx:for-item'] || 'item'
|
|
82
84
|
const indexName = attrsMap['wx:for-index'] || 'index'
|
|
@@ -189,15 +191,15 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
189
191
|
const styleBinding = []
|
|
190
192
|
el.isStyleParsed = true
|
|
191
193
|
el.attrsList.forEach((item) => {
|
|
192
|
-
const parsed =
|
|
194
|
+
const parsed = parseMustache(item.value)
|
|
193
195
|
if (item.name === 'style') {
|
|
194
196
|
if (parsed.hasBinding || parsed.result.indexOf('rpx') > -1) {
|
|
195
|
-
styleBinding.push(
|
|
197
|
+
styleBinding.push(parseMustache(item.value).result)
|
|
196
198
|
} else {
|
|
197
199
|
styleBinding.push(JSON.stringify(item.value))
|
|
198
200
|
}
|
|
199
201
|
} else if (item.name === 'wx:style') {
|
|
200
|
-
styleBinding.push(
|
|
202
|
+
styleBinding.push(parseMustache(item.value).result)
|
|
201
203
|
}
|
|
202
204
|
})
|
|
203
205
|
return {
|
|
@@ -210,7 +212,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
210
212
|
// 样式类名绑定
|
|
211
213
|
test: /^wx:(class)$/,
|
|
212
214
|
web ({ value }) {
|
|
213
|
-
const parsed =
|
|
215
|
+
const parsed = parseMustache(value)
|
|
214
216
|
return {
|
|
215
217
|
name: ':class',
|
|
216
218
|
value: parsed.result
|
|
@@ -264,7 +266,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
264
266
|
},
|
|
265
267
|
web ({ name, value }) {
|
|
266
268
|
let dir = this.test.exec(name)[1]
|
|
267
|
-
const parsed =
|
|
269
|
+
const parsed = parseMustache(value)
|
|
268
270
|
if (dir === 'elif') {
|
|
269
271
|
dir = 'else-if'
|
|
270
272
|
}
|
|
@@ -967,7 +967,7 @@ function processComponentIs (el, options) {
|
|
|
967
967
|
|
|
968
968
|
const is = getAndRemoveAttr(el, 'is').val
|
|
969
969
|
if (is) {
|
|
970
|
-
el.is =
|
|
970
|
+
el.is = parseMustache(is).result
|
|
971
971
|
} else {
|
|
972
972
|
warn$1('<component> tag should have attrs[is].')
|
|
973
973
|
}
|
|
@@ -979,7 +979,7 @@ function parseFuncStr2 (str) {
|
|
|
979
979
|
const funcRE = /^([^()]+)(\((.*)\))?/
|
|
980
980
|
const match = funcRE.exec(str)
|
|
981
981
|
if (match) {
|
|
982
|
-
const funcName =
|
|
982
|
+
const funcName = parseMustache(match[1]).result
|
|
983
983
|
const hasArgs = !!match[2]
|
|
984
984
|
let args = match[3] ? `,${match[3]}` : ''
|
|
985
985
|
const ret = /(,|^)\s*(\$event)\s*(,|$)/.exec(args)
|
|
@@ -1163,9 +1163,19 @@ function wrapMustache (val) {
|
|
|
1163
1163
|
return val && !tagRE.test(val) ? `{{${val}}}` : val
|
|
1164
1164
|
}
|
|
1165
1165
|
|
|
1166
|
-
function
|
|
1167
|
-
|
|
1168
|
-
|
|
1166
|
+
function parseMustache (raw = '') {
|
|
1167
|
+
let replaced = false
|
|
1168
|
+
if (tagRE.test(raw)) {
|
|
1169
|
+
const ret = []
|
|
1170
|
+
let lastLastIndex = 0
|
|
1171
|
+
let match
|
|
1172
|
+
while (match = tagREG.exec(raw)) {
|
|
1173
|
+
const pre = raw.substring(lastLastIndex, match.index)
|
|
1174
|
+
if (pre) {
|
|
1175
|
+
ret.push(stringify(pre))
|
|
1176
|
+
}
|
|
1177
|
+
let exp = match[1]
|
|
1178
|
+
|
|
1169
1179
|
// eval处理的话,和别的判断条件,比如运行时的判断混用情况下得不到一个结果,还是正则替换
|
|
1170
1180
|
const defKeys = Object.keys(defs)
|
|
1171
1181
|
defKeys.forEach((defKey) => {
|
|
@@ -1173,70 +1183,42 @@ function parseMustacheWithContext (raw = '') {
|
|
|
1173
1183
|
const defREG = new RegExp(`\\b${defKey}\\b`, 'g')
|
|
1174
1184
|
if (defRE.test(exp)) {
|
|
1175
1185
|
exp = exp.replace(defREG, stringify(defs[defKey]))
|
|
1186
|
+
replaced = true
|
|
1176
1187
|
}
|
|
1177
1188
|
})
|
|
1178
|
-
}
|
|
1179
1189
|
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1190
|
+
if (i18n) {
|
|
1191
|
+
for (const i18nFuncName of i18nFuncNames) {
|
|
1192
|
+
const funcNameRE = new RegExp(`(?<![A-Za-z0-9_$.])${i18nFuncName}\\(`)
|
|
1193
|
+
const funcNameREG = new RegExp(`(?<![A-Za-z0-9_$.])${i18nFuncName}\\(`, 'g')
|
|
1194
|
+
if (funcNameRE.test(exp)) {
|
|
1195
|
+
if (i18n.useComputed || !i18nFuncName.startsWith('\\$')) {
|
|
1196
|
+
const i18nInjectComputedKey = `_i${i18nInjectableComputed.length + 1}`
|
|
1197
|
+
i18nInjectableComputed.push(`${i18nInjectComputedKey} () {\nreturn ${exp.trim()}}`)
|
|
1198
|
+
exp = i18nInjectComputedKey
|
|
1199
|
+
} else {
|
|
1200
|
+
exp = exp.replace(funcNameREG, `${i18nModuleName}.$1(null, _l, _fl, `)
|
|
1201
|
+
}
|
|
1202
|
+
hasI18n = true
|
|
1203
|
+
replaced = true
|
|
1204
|
+
break
|
|
1191
1205
|
}
|
|
1192
|
-
hasI18n = true
|
|
1193
|
-
break
|
|
1194
1206
|
}
|
|
1195
1207
|
}
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
return exp
|
|
1199
|
-
})
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
function parseMustache (raw = '', expHandler = exp => exp, strHandler = str => str) {
|
|
1203
|
-
let replaced = false
|
|
1204
|
-
if (tagRE.test(raw)) {
|
|
1205
|
-
const ret = []
|
|
1206
|
-
let lastLastIndex = 0
|
|
1207
|
-
let match
|
|
1208
|
-
while (match = tagREG.exec(raw)) {
|
|
1209
|
-
const pre = raw.substring(lastLastIndex, match.index)
|
|
1210
|
-
if (pre) {
|
|
1211
|
-
const pre2 = strHandler(pre)
|
|
1212
|
-
if (pre2 !== pre) replaced = true
|
|
1213
|
-
if (pre2) ret.push(stringify(pre2))
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
const exp = match[1].trim()
|
|
1217
|
-
if (exp) {
|
|
1218
|
-
const exp2 = expHandler(exp)
|
|
1219
|
-
if (exp2 !== exp) replaced = true
|
|
1220
|
-
if (exp2) ret.push(`(${exp2})`)
|
|
1221
|
-
}
|
|
1222
1208
|
|
|
1209
|
+
ret.push(`(${exp.trim()})`)
|
|
1223
1210
|
lastLastIndex = tagREG.lastIndex
|
|
1224
1211
|
}
|
|
1225
|
-
|
|
1226
1212
|
const post = raw.substring(lastLastIndex)
|
|
1227
1213
|
if (post) {
|
|
1228
|
-
|
|
1229
|
-
if (post2 !== post) replaced = true
|
|
1230
|
-
if (post2) ret.push(stringify(post2))
|
|
1214
|
+
ret.push(stringify(post))
|
|
1231
1215
|
}
|
|
1232
|
-
|
|
1233
1216
|
let result
|
|
1234
1217
|
if (ret.length === 1) {
|
|
1235
1218
|
result = ret[0]
|
|
1236
1219
|
} else {
|
|
1237
1220
|
result = `(${ret.join('+')})`
|
|
1238
1221
|
}
|
|
1239
|
-
|
|
1240
1222
|
return {
|
|
1241
1223
|
result,
|
|
1242
1224
|
hasBinding: true,
|
|
@@ -1244,14 +1226,10 @@ function parseMustache (raw = '', expHandler = exp => exp, strHandler = str => s
|
|
|
1244
1226
|
replaced
|
|
1245
1227
|
}
|
|
1246
1228
|
}
|
|
1247
|
-
|
|
1248
|
-
const raw2 = strHandler(raw)
|
|
1249
|
-
if (raw2 !== raw) replaced = true
|
|
1250
|
-
|
|
1251
1229
|
return {
|
|
1252
|
-
result: stringify(
|
|
1230
|
+
result: stringify(raw),
|
|
1253
1231
|
hasBinding: false,
|
|
1254
|
-
val:
|
|
1232
|
+
val: raw,
|
|
1255
1233
|
replaced
|
|
1256
1234
|
}
|
|
1257
1235
|
}
|
|
@@ -1269,14 +1247,14 @@ function processIf (el) {
|
|
|
1269
1247
|
let val = getAndRemoveAttr(el, config[mode].directive.if).val
|
|
1270
1248
|
if (val) {
|
|
1271
1249
|
if (mode === 'swan') val = wrapMustache(val)
|
|
1272
|
-
const parsed =
|
|
1250
|
+
const parsed = parseMustache(val)
|
|
1273
1251
|
el.if = {
|
|
1274
1252
|
raw: parsed.val,
|
|
1275
1253
|
exp: parsed.result
|
|
1276
1254
|
}
|
|
1277
1255
|
} else if (val = getAndRemoveAttr(el, config[mode].directive.elseif).val) {
|
|
1278
1256
|
if (mode === 'swan') val = wrapMustache(val)
|
|
1279
|
-
const parsed =
|
|
1257
|
+
const parsed = parseMustache(val)
|
|
1280
1258
|
el.elseif = {
|
|
1281
1259
|
raw: parsed.val,
|
|
1282
1260
|
exp: parsed.result
|
|
@@ -1318,7 +1296,7 @@ function processFor (el) {
|
|
|
1318
1296
|
}
|
|
1319
1297
|
} else {
|
|
1320
1298
|
if (mode === 'swan') val = wrapMustache(val)
|
|
1321
|
-
const parsed =
|
|
1299
|
+
const parsed = parseMustache(val)
|
|
1322
1300
|
el.for = {
|
|
1323
1301
|
raw: parsed.val,
|
|
1324
1302
|
exp: parsed.result
|
|
@@ -1430,14 +1408,14 @@ function processAttrs (el, options) {
|
|
|
1430
1408
|
const isTemplateData = el.tag === 'template' && attr.name === 'data'
|
|
1431
1409
|
const needWrap = isTemplateData && mode !== 'swan'
|
|
1432
1410
|
const value = needWrap ? `{${attr.value}}` : attr.value
|
|
1433
|
-
const parsed =
|
|
1411
|
+
const parsed = parseMustache(value)
|
|
1434
1412
|
if (parsed.hasBinding) {
|
|
1435
1413
|
// 该属性判断用于提供给运行时对于计算属性作为props传递时提出警告
|
|
1436
1414
|
const isProps = isComponentNode(el, options) && !(attr.name === 'class' || attr.name === 'style')
|
|
1437
1415
|
addExp(el, parsed.result, isProps)
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1416
|
+
}
|
|
1417
|
+
if (parsed.replaced) {
|
|
1418
|
+
modifyAttr(el, attr.name, needWrap ? parsed.val.slice(1, -1) : parsed.val)
|
|
1441
1419
|
}
|
|
1442
1420
|
})
|
|
1443
1421
|
}
|
|
@@ -1569,7 +1547,7 @@ function processText (el) {
|
|
|
1569
1547
|
if (el.type !== 3 || el.isComment) {
|
|
1570
1548
|
return
|
|
1571
1549
|
}
|
|
1572
|
-
const parsed =
|
|
1550
|
+
const parsed = parseMustache(el.text)
|
|
1573
1551
|
if (parsed.hasBinding) {
|
|
1574
1552
|
addExp(el, parsed.result)
|
|
1575
1553
|
}
|
|
@@ -1614,8 +1592,8 @@ function processClass (el, meta) {
|
|
|
1614
1592
|
let staticClass = getAndRemoveAttr(el, type).val || ''
|
|
1615
1593
|
staticClass = staticClass.replace(/\s+/g, ' ')
|
|
1616
1594
|
if (dynamicClass) {
|
|
1617
|
-
const staticClassExp =
|
|
1618
|
-
const dynamicClassExp = transDynamicClassExpr(
|
|
1595
|
+
const staticClassExp = parseMustache(staticClass).result
|
|
1596
|
+
const dynamicClassExp = transDynamicClassExpr(parseMustache(dynamicClass).result, {
|
|
1619
1597
|
error: error$1
|
|
1620
1598
|
})
|
|
1621
1599
|
addAttrs(el, [{
|
|
@@ -1650,8 +1628,8 @@ function processStyle (el, meta) {
|
|
|
1650
1628
|
let staticStyle = getAndRemoveAttr(el, type).val || ''
|
|
1651
1629
|
staticStyle = staticStyle.replace(/\s+/g, ' ')
|
|
1652
1630
|
if (dynamicStyle) {
|
|
1653
|
-
const staticStyleExp =
|
|
1654
|
-
const dynamicStyleExp =
|
|
1631
|
+
const staticStyleExp = parseMustache(staticStyle).result
|
|
1632
|
+
const dynamicStyleExp = parseMustache(dynamicStyle).result
|
|
1655
1633
|
addAttrs(el, [{
|
|
1656
1634
|
name: targetType,
|
|
1657
1635
|
value: `{{${stringifyModuleName}.stringifyStyle(${staticStyleExp}, ${dynamicStyleExp})}}`
|
|
@@ -1892,7 +1870,7 @@ function processShow (el, options, root) {
|
|
|
1892
1870
|
if (options.hasVirtualHost) {
|
|
1893
1871
|
if (options.isComponent && el.parent === root && isRealNode(el)) {
|
|
1894
1872
|
if (show !== undefined) {
|
|
1895
|
-
show = `{{${
|
|
1873
|
+
show = `{{${parseMustache(show).result}&&mpxShow}}`
|
|
1896
1874
|
} else {
|
|
1897
1875
|
show = '{{mpxShow}}'
|
|
1898
1876
|
}
|
|
@@ -1914,7 +1892,7 @@ function processShow (el, options, root) {
|
|
|
1914
1892
|
|
|
1915
1893
|
function processShowStyle () {
|
|
1916
1894
|
if (show !== undefined) {
|
|
1917
|
-
const showExp =
|
|
1895
|
+
const showExp = parseMustache(show).result
|
|
1918
1896
|
let oldStyle = getAndRemoveAttr(el, 'style').val
|
|
1919
1897
|
oldStyle = oldStyle ? oldStyle + ';' : ''
|
|
1920
1898
|
addAttrs(el, [{
|
|
@@ -2398,7 +2376,6 @@ module.exports = {
|
|
|
2398
2376
|
makeAttrsMap,
|
|
2399
2377
|
stringifyAttr,
|
|
2400
2378
|
parseMustache,
|
|
2401
|
-
parseMustacheWithContext,
|
|
2402
2379
|
stringifyWithResolveComputed,
|
|
2403
2380
|
addAttrs
|
|
2404
2381
|
}
|
package/lib/wxss/loader.js
CHANGED
|
@@ -223,18 +223,18 @@ module.exports = async function loader (content, map, meta) {
|
|
|
223
223
|
imports.unshift({
|
|
224
224
|
type: 'api_import',
|
|
225
225
|
importName: '___CSS_LOADER_API_IMPORT___',
|
|
226
|
-
url: stringifyRequest(this, require.resolve('./runtime/api'))
|
|
226
|
+
url: stringifyRequest(this, '!!' + require.resolve('./runtime/api'))
|
|
227
227
|
})
|
|
228
228
|
|
|
229
229
|
if (options.sourceMap) {
|
|
230
230
|
imports.unshift({
|
|
231
231
|
importName: '___CSS_LOADER_API_SOURCEMAP_IMPORT___',
|
|
232
|
-
url: stringifyRequest(this, require.resolve('./runtime/sourceMaps'))
|
|
232
|
+
url: stringifyRequest(this, '!!' + require.resolve('./runtime/sourceMaps'))
|
|
233
233
|
})
|
|
234
234
|
} else {
|
|
235
235
|
imports.unshift({
|
|
236
236
|
importName: '___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___',
|
|
237
|
-
url: stringifyRequest(this, require.resolve('./runtime/noSourceMaps'))
|
|
237
|
+
url: stringifyRequest(this, '!!' + require.resolve('./runtime/noSourceMaps'))
|
|
238
238
|
})
|
|
239
239
|
}
|
|
240
240
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.8.28
|
|
3
|
+
"version": "2.8.28",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
7
7
|
],
|
|
8
8
|
"author": "donghongping",
|
|
9
|
-
"license": "Apache
|
|
9
|
+
"license": "Apache",
|
|
10
10
|
"main": "lib/index.js",
|
|
11
11
|
"directories": {
|
|
12
12
|
"lib": "lib"
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"@babel/parser": "^7.16.2",
|
|
21
21
|
"@babel/traverse": "^7.16.0",
|
|
22
22
|
"@babel/types": "^7.16.0",
|
|
23
|
-
"@better-scroll/core": "^2.
|
|
24
|
-
"@better-scroll/movable": "^2.
|
|
25
|
-
"@better-scroll/observe-dom": "^2.
|
|
26
|
-
"@better-scroll/pull-down": "^2.
|
|
27
|
-
"@better-scroll/slide": "^2.
|
|
28
|
-
"@better-scroll/wheel": "^2.
|
|
29
|
-
"@better-scroll/zoom": "^2.
|
|
23
|
+
"@better-scroll/core": "^2.5.1",
|
|
24
|
+
"@better-scroll/movable": "^2.5.1",
|
|
25
|
+
"@better-scroll/observe-dom": "^2.5.1",
|
|
26
|
+
"@better-scroll/pull-down": "^2.5.1",
|
|
27
|
+
"@better-scroll/slide": "^2.5.1",
|
|
28
|
+
"@better-scroll/wheel": "^2.5.1",
|
|
29
|
+
"@better-scroll/zoom": "^2.5.1",
|
|
30
30
|
"acorn-walk": "^7.2.0",
|
|
31
31
|
"async": "^2.6.0",
|
|
32
32
|
"consolidate": "^0.15.1",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"engines": {
|
|
83
83
|
"node": ">=14.14.0"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "4dc994fc42216ce85f58801578134184a2c279c8"
|
|
86
86
|
}
|