@mpxjs/webpack-plugin 2.8.29 → 2.8.31
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 +43 -0
- package/lib/runtime/components/web/mpx-video.vue +15 -1
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -1073,6 +1073,49 @@ class MpxWebpackPlugin {
|
|
|
1073
1073
|
}
|
|
1074
1074
|
})
|
|
1075
1075
|
|
|
1076
|
+
parser.hooks.evaluate.for('NewExpression').tap('MpxWebpackPlugin', (expression) => {
|
|
1077
|
+
if (/@intlify\/core-base/.test(parser.state.module.resource)) {
|
|
1078
|
+
if (expression.callee.name === 'Function') {
|
|
1079
|
+
const current = parser.state.current
|
|
1080
|
+
current.addPresentationalDependency(new InjectDependency({
|
|
1081
|
+
content: '_mpxCodeTransForm(',
|
|
1082
|
+
index: expression.arguments[0].start
|
|
1083
|
+
}))
|
|
1084
|
+
current.addPresentationalDependency(new InjectDependency({
|
|
1085
|
+
content: ')',
|
|
1086
|
+
index: expression.arguments[0].end
|
|
1087
|
+
}))
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
})
|
|
1091
|
+
|
|
1092
|
+
parser.hooks.program.tap('MpxWebpackPlugin', ast => {
|
|
1093
|
+
if (/@intlify\/core-base/.test(parser.state.module.resource)) {
|
|
1094
|
+
const current = parser.state.current
|
|
1095
|
+
current.addPresentationalDependency(new InjectDependency({
|
|
1096
|
+
content: 'function _mpxCodeTransForm (code) {\n' +
|
|
1097
|
+
' code = code.replace(/const { (.*?) } = ctx/g, function (match, $1) {\n' +
|
|
1098
|
+
' var arr = $1.split(", ")\n' +
|
|
1099
|
+
' var str = ""\n' +
|
|
1100
|
+
' var pattern = /(.*):(.*)/\n' +
|
|
1101
|
+
' for (var i = 0; i < arr.length; i++) {\n' +
|
|
1102
|
+
' var result = arr[i].match(pattern)\n' +
|
|
1103
|
+
' var left = result[1]\n' +
|
|
1104
|
+
' var right = result[2]\n' +
|
|
1105
|
+
' str += "var" + right + " = ctx." + left\n' +
|
|
1106
|
+
' }\n' +
|
|
1107
|
+
' return str\n' +
|
|
1108
|
+
' })\n' +
|
|
1109
|
+
' code = code.replace(/\\(ctx\\) =>/g, function (match, $1) {\n' +
|
|
1110
|
+
' return "function (ctx)"\n' +
|
|
1111
|
+
' })\n' +
|
|
1112
|
+
' return code\n' +
|
|
1113
|
+
'}',
|
|
1114
|
+
index: ast.end
|
|
1115
|
+
}))
|
|
1116
|
+
}
|
|
1117
|
+
})
|
|
1118
|
+
|
|
1076
1119
|
// 处理跨平台转换
|
|
1077
1120
|
if (mpx.srcMode !== mpx.mode) {
|
|
1078
1121
|
// 处理跨平台全局对象转换
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
<video
|
|
3
3
|
ref="_mpx_video_ref"
|
|
4
4
|
:class="classList"
|
|
5
|
-
webkit-playsinline="true" playsinline="true" x5-playsinline="true"
|
|
6
5
|
:src="src"
|
|
7
6
|
:controls="showControlsTool"
|
|
8
7
|
:autoplay="autoplay"
|
|
9
8
|
:loop="loop"
|
|
10
9
|
:muted="mutedCopy"
|
|
11
10
|
:poster="poster"
|
|
11
|
+
v-bind="playsinlineAttr"
|
|
12
12
|
>
|
|
13
13
|
</video>
|
|
14
14
|
</template>
|
|
@@ -123,6 +123,20 @@
|
|
|
123
123
|
showScreenLockButton: {
|
|
124
124
|
type: Boolean,
|
|
125
125
|
default: false
|
|
126
|
+
},
|
|
127
|
+
playsinline: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: true
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
computed: {
|
|
133
|
+
playsinlineAttr () {
|
|
134
|
+
if (!this.playsinline) return {}
|
|
135
|
+
return {
|
|
136
|
+
'webkit-playsinline': true,
|
|
137
|
+
'playsinline': true,
|
|
138
|
+
'x5-playsinline': true
|
|
139
|
+
}
|
|
126
140
|
}
|
|
127
141
|
},
|
|
128
142
|
data () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.31",
|
|
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": "00db3e700a9fd0a06ad188c1d9972182cac96db7"
|
|
86
86
|
}
|