@mpxjs/webpack-plugin 2.8.25-alpha → 2.8.25
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/README.md +1 -1
- package/lib/config.js +0 -14
- package/lib/dependencies/ResolveDependency.js +0 -4
- package/lib/index.js +5 -35
- package/lib/loader.js +0 -40
- package/lib/platform/template/wx/component-config/button.js +2 -14
- package/lib/platform/template/wx/component-config/image.js +0 -4
- package/lib/platform/template/wx/component-config/input.js +0 -4
- package/lib/platform/template/wx/component-config/rich-text.js +0 -4
- package/lib/platform/template/wx/component-config/scroll-view.js +0 -4
- package/lib/platform/template/wx/component-config/switch.js +0 -4
- package/lib/platform/template/wx/component-config/text.js +0 -4
- package/lib/platform/template/wx/component-config/textarea.js +0 -5
- package/lib/platform/template/wx/component-config/view.js +0 -4
- package/lib/platform/template/wx/index.js +1 -121
- package/lib/resolve-loader.js +1 -4
- package/lib/style-compiler/index.js +1 -1
- package/lib/template-compiler/compiler.js +2 -11
- package/package.json +2 -5
- package/lib/dependencies/AddEntryDependency.js +0 -24
- package/lib/runtime/components/tenon/getInnerListeners.js +0 -314
- package/lib/runtime/components/tenon/tenon-button.vue +0 -305
- package/lib/runtime/components/tenon/tenon-image.vue +0 -61
- package/lib/runtime/components/tenon/tenon-input.vue +0 -104
- package/lib/runtime/components/tenon/tenon-rich-text.vue +0 -21
- package/lib/runtime/components/tenon/tenon-scroll-view.vue +0 -124
- package/lib/runtime/components/tenon/tenon-switch.vue +0 -91
- package/lib/runtime/components/tenon/tenon-text-area.vue +0 -77
- package/lib/runtime/components/tenon/tenon-text.vue +0 -64
- package/lib/runtime/components/tenon/tenon-view.vue +0 -93
- package/lib/runtime/optionProcessor.tenon.js +0 -388
- package/lib/style-compiler/plugins/hm.js +0 -20
- package/lib/tenon/index.js +0 -104
- package/lib/tenon/processJSON.js +0 -356
- package/lib/tenon/processScript.js +0 -263
- package/lib/tenon/processStyles.js +0 -21
- package/lib/tenon/processTemplate.js +0 -133
- package/lib/utils/get-relative-path.js +0 -25
package/README.md
CHANGED
package/lib/config.js
CHANGED
|
@@ -356,20 +356,6 @@ module.exports = {
|
|
|
356
356
|
templatePrefix: 'module.exports = \n'
|
|
357
357
|
}
|
|
358
358
|
},
|
|
359
|
-
tenon: {
|
|
360
|
-
directive: {
|
|
361
|
-
if: 'v-if',
|
|
362
|
-
elseif: 'v-else-if',
|
|
363
|
-
else: 'v-else'
|
|
364
|
-
},
|
|
365
|
-
wxs: {
|
|
366
|
-
tag: 'wxs',
|
|
367
|
-
module: 'module',
|
|
368
|
-
src: 'src',
|
|
369
|
-
ext: '.wxs',
|
|
370
|
-
templatePrefix: 'module.exports = \n'
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
359
|
qa: {
|
|
374
360
|
typeExtMap: {
|
|
375
361
|
json: '.json',
|
|
@@ -74,10 +74,6 @@ ResolveDependency.Template = class ResolveDependencyTemplate {
|
|
|
74
74
|
|
|
75
75
|
getContent (dep) {
|
|
76
76
|
const { resolved = '' } = dep
|
|
77
|
-
// for tenon
|
|
78
|
-
if (dep.compilation.__mpx__.mode === 'tenon') {
|
|
79
|
-
return `getRelativePath(currentURL, ${JSON.stringify(resolved)}) + '.js'`
|
|
80
|
-
}
|
|
81
77
|
// ?resolve 必定返回绝对路径
|
|
82
78
|
return JSON.stringify('/' + resolved)
|
|
83
79
|
}
|
package/lib/index.js
CHANGED
|
@@ -317,7 +317,7 @@ class MpxWebpackPlugin {
|
|
|
317
317
|
let splitChunksPlugin
|
|
318
318
|
let splitChunksOptions
|
|
319
319
|
|
|
320
|
-
if (this.options.mode !== 'web'
|
|
320
|
+
if (this.options.mode !== 'web') {
|
|
321
321
|
const optimization = compiler.options.optimization
|
|
322
322
|
optimization.runtimeChunk = {
|
|
323
323
|
name: (entrypoint) => {
|
|
@@ -1073,27 +1073,7 @@ class MpxWebpackPlugin {
|
|
|
1073
1073
|
}
|
|
1074
1074
|
})
|
|
1075
1075
|
|
|
1076
|
-
//
|
|
1077
|
-
if (mpx.mode === 'tenon') {
|
|
1078
|
-
let TENON_STORE_ID = 0
|
|
1079
|
-
parser.hooks.call.for('imported var').tap('MpxWebpackPlugin', (expr) => {
|
|
1080
|
-
if (['createStore', 'createStoreWithThis'].includes(expr.callee.name)) {
|
|
1081
|
-
const current = parser.state.current
|
|
1082
|
-
const storeOptions = expr.arguments.length && expr.arguments[0]
|
|
1083
|
-
if (storeOptions) {
|
|
1084
|
-
current.addDependency(new InjectDependency({
|
|
1085
|
-
content: 'Object.assign(',
|
|
1086
|
-
index: storeOptions.range[0]
|
|
1087
|
-
}))
|
|
1088
|
-
current.addDependency(new InjectDependency({
|
|
1089
|
-
content: `, { __store_id: ${TENON_STORE_ID++} })`,
|
|
1090
|
-
index: storeOptions.range[1]
|
|
1091
|
-
}))
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
})
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1076
|
+
// 处理跨平台转换
|
|
1097
1077
|
if (mpx.srcMode !== mpx.mode) {
|
|
1098
1078
|
// 处理跨平台全局对象转换
|
|
1099
1079
|
const transGlobalObject = (expr) => {
|
|
@@ -1217,7 +1197,7 @@ class MpxWebpackPlugin {
|
|
|
1217
1197
|
name: 'MpxWebpackPlugin',
|
|
1218
1198
|
stage: compilation.PROCESS_ASSETS_STAGE_ADDITIONS
|
|
1219
1199
|
}, () => {
|
|
1220
|
-
if (mpx.mode === 'web'
|
|
1200
|
+
if (mpx.mode === 'web') return
|
|
1221
1201
|
|
|
1222
1202
|
if (this.options.generateBuildMap) {
|
|
1223
1203
|
const pagesMap = compilation.__mpx__.pagesMap
|
|
@@ -1455,31 +1435,21 @@ try {
|
|
|
1455
1435
|
if (mpx.mode === 'web') {
|
|
1456
1436
|
const mpxStyleOptions = queryObj.mpxStyleOptions
|
|
1457
1437
|
const firstLoader = loaders[0] ? toPosix(loaders[0].loader) : ''
|
|
1458
|
-
const isPitcherRequest = firstLoader.includes('vue-loader/lib/loaders/pitcher')
|
|
1438
|
+
const isPitcherRequest = firstLoader.includes('vue-loader/lib/loaders/pitcher')
|
|
1459
1439
|
let cssLoaderIndex = -1
|
|
1460
1440
|
let vueStyleLoaderIndex = -1
|
|
1461
1441
|
let mpxStyleLoaderIndex = -1
|
|
1462
|
-
let tenonStyleLoaderIndex = -1
|
|
1463
1442
|
loaders.forEach((loader, index) => {
|
|
1464
1443
|
const currentLoader = toPosix(loader.loader)
|
|
1465
1444
|
if (currentLoader.includes('css-loader') && cssLoaderIndex === -1) {
|
|
1466
1445
|
cssLoaderIndex = index
|
|
1467
1446
|
} else if (currentLoader.includes('vue-loader/lib/loaders/stylePostLoader') && vueStyleLoaderIndex === -1) {
|
|
1468
1447
|
vueStyleLoaderIndex = index
|
|
1469
|
-
} else if (currentLoader.includes('@hummer/tenon-style-loader/dist/index.js') && tenonStyleLoaderIndex === -1) {
|
|
1470
|
-
tenonStyleLoaderIndex = index
|
|
1471
1448
|
} else if (currentLoader.includes(styleCompilerPath) && mpxStyleLoaderIndex === -1) {
|
|
1472
1449
|
mpxStyleLoaderIndex = index
|
|
1473
1450
|
}
|
|
1474
1451
|
})
|
|
1475
|
-
if (
|
|
1476
|
-
if (tenonStyleLoaderIndex > -1 && !isPitcherRequest) {
|
|
1477
|
-
loaders.splice(tenonStyleLoaderIndex + 1, 0, {
|
|
1478
|
-
loader: normalize.lib('style-compiler/index.js'),
|
|
1479
|
-
options: (mpxStyleOptions && JSON.parse(mpxStyleOptions)) || {}
|
|
1480
|
-
})
|
|
1481
|
-
}
|
|
1482
|
-
} else if (mpxStyleLoaderIndex === -1) {
|
|
1452
|
+
if (mpxStyleLoaderIndex === -1) {
|
|
1483
1453
|
let loaderIndex = -1
|
|
1484
1454
|
if (cssLoaderIndex > -1 && vueStyleLoaderIndex === -1) {
|
|
1485
1455
|
loaderIndex = cssLoaderIndex
|
package/lib/loader.js
CHANGED
|
@@ -11,7 +11,6 @@ const processJSON = require('./web/processJSON')
|
|
|
11
11
|
const processScript = require('./web/processScript')
|
|
12
12
|
const processStyles = require('./web/processStyles')
|
|
13
13
|
const processTemplate = require('./web/processTemplate')
|
|
14
|
-
const processForTenon = require('./tenon/index')
|
|
15
14
|
const getJSONContent = require('./utils/get-json-content')
|
|
16
15
|
const normalize = require('./utils/normalize')
|
|
17
16
|
const getEntryName = require('./utils/get-entry-name')
|
|
@@ -128,45 +127,6 @@ module.exports = function (content) {
|
|
|
128
127
|
return callback(e)
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
|
-
|
|
132
|
-
if (mode === 'tenon') {
|
|
133
|
-
if (ctorType === 'app' && !queryObj.app) {
|
|
134
|
-
const request = addQuery(this.resource, { app: true })
|
|
135
|
-
output += `
|
|
136
|
-
import App from ${stringifyRequest(request)}
|
|
137
|
-
import * as Tenon from '@hummer/tenon-vue'
|
|
138
|
-
|
|
139
|
-
Tenon.render(App)\n`
|
|
140
|
-
// 直接结束loader进入parse
|
|
141
|
-
this.loaderIndex = -1
|
|
142
|
-
return callback(null, output)
|
|
143
|
-
}
|
|
144
|
-
if (ctorType === 'page' && queryObj.tenon) {
|
|
145
|
-
console.log(resourcePath)
|
|
146
|
-
const request = addQuery(resourcePath, { page: true })
|
|
147
|
-
output += `
|
|
148
|
-
import page from ${stringifyRequest(request)}
|
|
149
|
-
import * as Tenon from '@hummer/tenon-vue'
|
|
150
|
-
|
|
151
|
-
Tenon.render(page)\n`
|
|
152
|
-
this.loaderIndex = -1
|
|
153
|
-
return callback(null, output)
|
|
154
|
-
}
|
|
155
|
-
return processForTenon({
|
|
156
|
-
mpx,
|
|
157
|
-
loaderContext,
|
|
158
|
-
isProduction,
|
|
159
|
-
queryObj,
|
|
160
|
-
filePath,
|
|
161
|
-
parts,
|
|
162
|
-
ctorType,
|
|
163
|
-
autoScope,
|
|
164
|
-
componentsMap,
|
|
165
|
-
moduleId,
|
|
166
|
-
callback
|
|
167
|
-
})
|
|
168
|
-
}
|
|
169
|
-
|
|
170
130
|
// 处理mode为web时输出vue格式文件
|
|
171
131
|
if (mode === 'web') {
|
|
172
132
|
if (ctorType === 'app' && !queryObj.isApp) {
|
|
@@ -28,8 +28,6 @@ module.exports = function ({ print }) {
|
|
|
28
28
|
const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' })
|
|
29
29
|
const webPropLog = print({ platform: 'web', tag: TAG_NAME, isError: false })
|
|
30
30
|
const webEventLog = print({ platform: 'web', tag: TAG_NAME, isError: false, type: 'event' })
|
|
31
|
-
const tenonPropLog = print({ platform: 'tenon', tag: TAG_NAME, isError: false })
|
|
32
|
-
const tenonEventLog = print({ platform: 'tenon', tag: TAG_NAME, isError: false, type: 'event' })
|
|
33
31
|
const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
|
|
34
32
|
const wxPropValueLog = print({ platform: 'wx', tag: TAG_NAME, isError: false, type: 'value' })
|
|
35
33
|
|
|
@@ -39,10 +37,6 @@ module.exports = function ({ print }) {
|
|
|
39
37
|
el.isBuiltIn = true
|
|
40
38
|
return 'mpx-button'
|
|
41
39
|
},
|
|
42
|
-
tenon (tag, { el }) {
|
|
43
|
-
el.isBuiltIn = true
|
|
44
|
-
return 'tenon-button'
|
|
45
|
-
},
|
|
46
40
|
props: [
|
|
47
41
|
{
|
|
48
42
|
test: 'open-type',
|
|
@@ -137,18 +131,13 @@ module.exports = function ({ print }) {
|
|
|
137
131
|
},
|
|
138
132
|
{
|
|
139
133
|
test: /^(open-type|lang|session-from|send-message-title|send-message-path|send-message-img|show-message-card|app-parameter)$/,
|
|
140
|
-
web: webPropLog
|
|
141
|
-
tenon: tenonPropLog
|
|
134
|
+
web: webPropLog
|
|
142
135
|
},
|
|
143
136
|
{
|
|
144
137
|
test: /^(size|type|plain|loading|form-type|hover-class|hover-stop-propagation|hover-start-time|hover-stay-time|use-built-in)$/,
|
|
145
138
|
web (prop, { el }) {
|
|
146
139
|
// todo 这部分能力基于内部封装实现
|
|
147
140
|
el.isBuiltIn = true
|
|
148
|
-
},
|
|
149
|
-
tenon (prop, { el }) {
|
|
150
|
-
// todo 这部分能力基于内部封装实现
|
|
151
|
-
el.isBuiltIn = true
|
|
152
141
|
}
|
|
153
142
|
},
|
|
154
143
|
{
|
|
@@ -185,8 +174,7 @@ module.exports = function ({ print }) {
|
|
|
185
174
|
},
|
|
186
175
|
{
|
|
187
176
|
test: /^(getuserinfo|contact|error|launchapp|opensetting|getphonenumber)$/,
|
|
188
|
-
web: webEventLog
|
|
189
|
-
tenon: tenonEventLog
|
|
177
|
+
web: webEventLog
|
|
190
178
|
}
|
|
191
179
|
]
|
|
192
180
|
}
|
|
@@ -20,10 +20,6 @@ module.exports = function ({ print }) {
|
|
|
20
20
|
el.isBuiltIn = true
|
|
21
21
|
return 'mpx-input'
|
|
22
22
|
},
|
|
23
|
-
tenon (tag, { el }) {
|
|
24
|
-
el.isBuiltIn = true
|
|
25
|
-
return 'tenon-input'
|
|
26
|
-
},
|
|
27
23
|
props: [
|
|
28
24
|
{
|
|
29
25
|
test: /^(cursor-spacing|auto-focus|adjust-position|hold-keyboard)$/,
|
|
@@ -19,10 +19,6 @@ module.exports = function ({ print }) {
|
|
|
19
19
|
el.isBuiltIn = true
|
|
20
20
|
return 'mpx-scroll-view'
|
|
21
21
|
},
|
|
22
|
-
tenon (tag, { el }) {
|
|
23
|
-
el.isBuiltIn = true
|
|
24
|
-
return 'tenon-scroll-view'
|
|
25
|
-
},
|
|
26
22
|
props: [
|
|
27
23
|
{
|
|
28
24
|
test: /^(enable-flex|scroll-anchorin|refresher-enabled|refresher-threshold|refresher-default-style|refresher-background|refresher-triggered|enhanced|bounces|show-scrollbar|paging-enabled|fast-deceleratio)$/,
|
|
@@ -22,11 +22,6 @@ module.exports = function ({ print }) {
|
|
|
22
22
|
el.isBuiltIn = true
|
|
23
23
|
return 'mpx-textarea'
|
|
24
24
|
},
|
|
25
|
-
tenon (tag, { el }) {
|
|
26
|
-
// form全量使用内建组件
|
|
27
|
-
el.isBuiltIn = true
|
|
28
|
-
return 'tenon-textarea'
|
|
29
|
-
},
|
|
30
25
|
props: [
|
|
31
26
|
{
|
|
32
27
|
test: /^(auto-focus|fixed|cursor-spacing|cursor|show-confirm-bar|selection-start|selection-end|adjust-position|hold-keyboard|disable-default-padding|confirm-type)$/,
|
|
@@ -10,7 +10,7 @@ const normalize = require('../../../utils/normalize')
|
|
|
10
10
|
|
|
11
11
|
module.exports = function getSpec ({ warn, error }) {
|
|
12
12
|
const spec = {
|
|
13
|
-
supportedModes: ['ali', 'swan', 'qq', 'tt', 'web', 'qa', 'jd', 'dd'
|
|
13
|
+
supportedModes: ['ali', 'swan', 'qq', 'tt', 'web', 'qa', 'jd', 'dd'],
|
|
14
14
|
// props预处理
|
|
15
15
|
preProps: [],
|
|
16
16
|
// props后处理
|
|
@@ -24,15 +24,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
24
24
|
value: parsed.result
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
tenon ({ name, value }) {
|
|
29
|
-
const parsed = parseMustache(value)
|
|
30
|
-
if (parsed.hasBinding) {
|
|
31
|
-
return {
|
|
32
|
-
name: name === 'animation' ? 'v-' + name : ':' + name,
|
|
33
|
-
value: parsed.result
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
27
|
}
|
|
37
28
|
}
|
|
38
29
|
],
|
|
@@ -95,16 +86,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
95
86
|
name: 'v-for',
|
|
96
87
|
value: `(${itemName}, ${indexName}) in ${parsed.result}`
|
|
97
88
|
}
|
|
98
|
-
},
|
|
99
|
-
tenon ({ value }, { el }) {
|
|
100
|
-
const parsed = parseMustache(value)
|
|
101
|
-
const attrsMap = el.attrsMap
|
|
102
|
-
const itemName = attrsMap['wx:for-item'] || 'item'
|
|
103
|
-
const indexName = attrsMap['wx:for-index'] || 'index'
|
|
104
|
-
return {
|
|
105
|
-
name: 'v-for',
|
|
106
|
-
value: `(${itemName}, ${indexName}) in ${parsed.result}`
|
|
107
|
-
}
|
|
108
89
|
}
|
|
109
90
|
},
|
|
110
91
|
{
|
|
@@ -130,25 +111,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
130
111
|
name: ':key',
|
|
131
112
|
value
|
|
132
113
|
}
|
|
133
|
-
},
|
|
134
|
-
tenon ({ value }, { el }) {
|
|
135
|
-
// vue的template中不能包含key,对应于小程序中的block
|
|
136
|
-
if (el.tag === 'block') return false
|
|
137
|
-
const itemName = el.attrsMap['wx:for-item'] || 'item'
|
|
138
|
-
const keyName = value
|
|
139
|
-
if (value === '*this') {
|
|
140
|
-
value = itemName
|
|
141
|
-
} else {
|
|
142
|
-
if (isValidIdentifierStr(keyName)) {
|
|
143
|
-
value = `${itemName}.${keyName}`
|
|
144
|
-
} else {
|
|
145
|
-
value = `${itemName}['${keyName}']`
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return {
|
|
149
|
-
name: ':key',
|
|
150
|
-
value
|
|
151
|
-
}
|
|
152
114
|
}
|
|
153
115
|
},
|
|
154
116
|
{
|
|
@@ -159,9 +121,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
159
121
|
},
|
|
160
122
|
web () {
|
|
161
123
|
return false
|
|
162
|
-
},
|
|
163
|
-
tenon () {
|
|
164
|
-
return false
|
|
165
124
|
}
|
|
166
125
|
},
|
|
167
126
|
{
|
|
@@ -204,49 +163,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
204
163
|
}
|
|
205
164
|
]
|
|
206
165
|
}
|
|
207
|
-
},
|
|
208
|
-
tenon ({ value }, { el }) {
|
|
209
|
-
el.hasEvent = true
|
|
210
|
-
const attrsMap = el.attrsMap
|
|
211
|
-
const tagRE = /\{\{((?:.|\n|\r)+?)\}\}(?!})/
|
|
212
|
-
const stringify = JSON.stringify
|
|
213
|
-
const match = tagRE.exec(value)
|
|
214
|
-
if (match) {
|
|
215
|
-
const modelProp = attrsMap['wx:model-prop'] || 'value'
|
|
216
|
-
const modelEvent = attrsMap['wx:model-event'] || 'input'
|
|
217
|
-
const modelValuePathRaw = attrsMap['wx:model-value-path']
|
|
218
|
-
const modelValuePath = modelValuePathRaw === undefined ? 'value' : modelValuePathRaw
|
|
219
|
-
const modelFilter = attrsMap['wx:model-filter']
|
|
220
|
-
let modelValuePathArr
|
|
221
|
-
try {
|
|
222
|
-
modelValuePathArr = JSON5.parse(modelValuePath)
|
|
223
|
-
} catch (e) {
|
|
224
|
-
if (modelValuePath === '') {
|
|
225
|
-
modelValuePathArr = []
|
|
226
|
-
} else {
|
|
227
|
-
modelValuePathArr = modelValuePath.split('.')
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
const modelValue = match[1].trim()
|
|
231
|
-
return [
|
|
232
|
-
{
|
|
233
|
-
name: ':' + modelProp,
|
|
234
|
-
value: modelValue
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
name: 'mpxModelEvent',
|
|
238
|
-
value: modelEvent
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
name: 'mpxModelEventId',
|
|
242
|
-
value: Math.random().toString(36).slice(3, 11)
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
name: '@mpxModel',
|
|
246
|
-
value: `__model(${stringifyWithResolveComputed(modelValue)}, $event, ${stringify(modelValuePathArr)}, ${stringify(modelFilter)})`
|
|
247
|
-
}
|
|
248
|
-
]
|
|
249
|
-
}
|
|
250
166
|
}
|
|
251
167
|
},
|
|
252
168
|
{
|
|
@@ -301,14 +217,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
301
217
|
name: ':class',
|
|
302
218
|
value: parsed.result
|
|
303
219
|
}
|
|
304
|
-
},
|
|
305
|
-
tenon ({ name, value }) {
|
|
306
|
-
const dir = this.test.exec(name)[1]
|
|
307
|
-
const parsed = parseMustache(value)
|
|
308
|
-
return {
|
|
309
|
-
name: ':' + dir,
|
|
310
|
-
value: parsed.result
|
|
311
|
-
}
|
|
312
220
|
}
|
|
313
221
|
},
|
|
314
222
|
// 通用指令
|
|
@@ -366,17 +274,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
366
274
|
name: 'v-' + dir,
|
|
367
275
|
value: parsed.result
|
|
368
276
|
}
|
|
369
|
-
},
|
|
370
|
-
tenon ({ name, value }) {
|
|
371
|
-
let dir = this.test.exec(name)[1]
|
|
372
|
-
const parsed = parseMustache(value)
|
|
373
|
-
if (dir === 'elif') {
|
|
374
|
-
dir = 'else-if'
|
|
375
|
-
}
|
|
376
|
-
return {
|
|
377
|
-
name: 'v-' + dir,
|
|
378
|
-
value: parsed.result
|
|
379
|
-
}
|
|
380
277
|
}
|
|
381
278
|
},
|
|
382
279
|
// 事件
|
|
@@ -449,23 +346,6 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
449
346
|
name: rPrefix + rEventName + meta.modifierStr,
|
|
450
347
|
value
|
|
451
348
|
}
|
|
452
|
-
},
|
|
453
|
-
tenon ({ name, value }, { eventRules, el }) {
|
|
454
|
-
const match = this.test.exec(name)
|
|
455
|
-
const prefix = match[1]
|
|
456
|
-
const eventName = match[2]
|
|
457
|
-
const modifierStr = match[3] || ''
|
|
458
|
-
const meta = {
|
|
459
|
-
modifierStr
|
|
460
|
-
}
|
|
461
|
-
// 记录event监听信息用于后续判断是否需要使用内置基础组件
|
|
462
|
-
el.hasEvent = true
|
|
463
|
-
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'web', meta })
|
|
464
|
-
const rEventName = runRules(eventRules, eventName, { mode: 'web' })
|
|
465
|
-
return {
|
|
466
|
-
name: rPrefix + rEventName + meta.modifierStr,
|
|
467
|
-
value
|
|
468
|
-
}
|
|
469
349
|
}
|
|
470
350
|
},
|
|
471
351
|
// 无障碍
|
package/lib/resolve-loader.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
module.exports = function () {
|
|
2
|
-
return `
|
|
3
|
-
var currentURL = global.currentPagePath
|
|
4
|
-
var getRelativePath = require('@mpxjs/webpack-plugin/lib/utils/get-relative-path').getRelativePath
|
|
5
|
-
module.exports = __mpx_resolve_path__(${JSON.stringify(this.resource)})`
|
|
2
|
+
return `module.exports = __mpx_resolve_path__(${JSON.stringify(this.resource)})`
|
|
6
3
|
}
|
|
@@ -23,7 +23,7 @@ module.exports = function (css, map) {
|
|
|
23
23
|
const transRpxRulesRaw = mpx.transRpxRules
|
|
24
24
|
const transRpxRules = transRpxRulesRaw ? (Array.isArray(transRpxRulesRaw) ? transRpxRulesRaw : [transRpxRulesRaw]) : []
|
|
25
25
|
|
|
26
|
-
const transRpxFn = mpx.webConfig
|
|
26
|
+
const transRpxFn = mpx.webConfig.transRpxFn
|
|
27
27
|
const testResolveRange = (include = () => true, exclude) => {
|
|
28
28
|
return matchCondition(this.resourcePath, { include, exclude })
|
|
29
29
|
}
|
|
@@ -2065,15 +2065,6 @@ function processElement (el, root, options, meta) {
|
|
|
2065
2065
|
processComponentGenericsForWeb(el, options, meta)
|
|
2066
2066
|
return
|
|
2067
2067
|
}
|
|
2068
|
-
if (mode === 'tenon') {
|
|
2069
|
-
// 收集内建组件
|
|
2070
|
-
processBuiltInComponents(el, meta)
|
|
2071
|
-
// 预处理代码维度条件编译
|
|
2072
|
-
processIfForWeb(el)
|
|
2073
|
-
// processWebExternalClassesHack(el, options)
|
|
2074
|
-
// processComponentGenericsForWeb(el, options, meta)
|
|
2075
|
-
return
|
|
2076
|
-
}
|
|
2077
2068
|
|
|
2078
2069
|
const pass = isNative || processTemplate(el) || processingTemplate
|
|
2079
2070
|
|
|
@@ -2106,7 +2097,7 @@ function processElement (el, root, options, meta) {
|
|
|
2106
2097
|
|
|
2107
2098
|
function closeElement (el, meta, options) {
|
|
2108
2099
|
postProcessAtMode(el)
|
|
2109
|
-
if (mode === 'web'
|
|
2100
|
+
if (mode === 'web') {
|
|
2110
2101
|
postProcessWxs(el, meta)
|
|
2111
2102
|
// 处理代码维度条件编译移除死分支
|
|
2112
2103
|
postProcessIf(el)
|
|
@@ -2220,7 +2211,7 @@ function serialize (root) {
|
|
|
2220
2211
|
result += node.text
|
|
2221
2212
|
}
|
|
2222
2213
|
}
|
|
2223
|
-
if (node.tag === 'wxs' &&
|
|
2214
|
+
if (node.tag === 'wxs' && mode === 'web') {
|
|
2224
2215
|
return result
|
|
2225
2216
|
}
|
|
2226
2217
|
if (node.type === 1) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.8.25
|
|
3
|
+
"version": "2.8.25",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -27,9 +27,6 @@
|
|
|
27
27
|
"@better-scroll/slide": "^2.2.1",
|
|
28
28
|
"@better-scroll/wheel": "^2.2.1",
|
|
29
29
|
"@better-scroll/zoom": "^2.2.1",
|
|
30
|
-
"@hummer/tenon-dev-server-webpack-plugin": "0.0.2",
|
|
31
|
-
"@hummer/tenon-loader": "^1.1.0",
|
|
32
|
-
"@hummer/tenon-style-loader": "^0.2.0",
|
|
33
30
|
"acorn-walk": "^7.2.0",
|
|
34
31
|
"async": "^2.6.0",
|
|
35
32
|
"consolidate": "^0.15.1",
|
|
@@ -85,5 +82,5 @@
|
|
|
85
82
|
"engines": {
|
|
86
83
|
"node": ">=14.14.0"
|
|
87
84
|
},
|
|
88
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "f144694b7bc4db69572b1b3b1123c720a6cca018"
|
|
89
86
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const NullDependency = require('webpack/lib/dependencies/NullDependency')
|
|
2
|
-
|
|
3
|
-
class AddEntryDependency extends NullDependency {
|
|
4
|
-
constructor ({ context, dep, name }) {
|
|
5
|
-
super()
|
|
6
|
-
this.__addEntryParams = [context, dep, name]
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
get type () {
|
|
10
|
-
return 'mpx add entry'
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// updateHash (hash) {
|
|
14
|
-
// super.updateHash(hash)
|
|
15
|
-
// hash.update(this.childCompileEntryModule.identifier())
|
|
16
|
-
// }
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
AddEntryDependency.Template = class AddEntryDependencyTemplate {
|
|
20
|
-
apply () {
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
module.exports = AddEntryDependency
|