@mpxjs/webpack-plugin 2.8.25-alpha → 2.8.25-alpha.10
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/ResolveDependency.js +2 -1
- package/lib/loader.js +3 -1
- package/lib/platform/template/wx/index.js +6 -0
- package/lib/runtime/components/tenon/tenon-button.vue +4 -0
- package/lib/runtime/components/tenon/tenon-image.vue +6 -0
- package/lib/runtime/components/tenon/tenon-rich-text.vue +6 -1
- package/lib/runtime/components/tenon/tenon-scroll-view.vue +3 -0
- package/lib/runtime/components/tenon/tenon-switch.vue +5 -0
- package/lib/runtime/components/tenon/tenon-text.vue +6 -0
- package/lib/runtime/components/tenon/{tenon-text-area.vue → tenon-textarea.vue} +0 -1
- package/lib/template-compiler/compiler.js +1 -1
- package/lib/tenon/processJSON.js +5 -9
- package/lib/tenon/processScript.js +12 -5
- package/package.json +3 -3
|
@@ -76,7 +76,8 @@ ResolveDependency.Template = class ResolveDependencyTemplate {
|
|
|
76
76
|
const { resolved = '' } = dep
|
|
77
77
|
// for tenon
|
|
78
78
|
if (dep.compilation.__mpx__.mode === 'tenon') {
|
|
79
|
-
|
|
79
|
+
// 暂时仅支持所有产物在一个目录下的场景
|
|
80
|
+
return `(Hummer.pageInfo && Hummer.pageInfo.url && Hummer.pageInfo.url.replace(/\\/[^/]+(?=\\.[^.]+($|\\?))/, '/${resolved}') || './${resolved}.js')`
|
|
80
81
|
}
|
|
81
82
|
// ?resolve 必定返回绝对路径
|
|
82
83
|
return JSON.stringify('/' + resolved)
|
package/lib/loader.js
CHANGED
|
@@ -70,7 +70,9 @@ module.exports = function (content) {
|
|
|
70
70
|
|
|
71
71
|
if (ctorType === 'app') {
|
|
72
72
|
const appName = getEntryName(this)
|
|
73
|
-
|
|
73
|
+
if (appName) {
|
|
74
|
+
this._module.addPresentationalDependency(new AppEntryDependency(resourcePath, appName))
|
|
75
|
+
}
|
|
74
76
|
}
|
|
75
77
|
const loaderContext = this
|
|
76
78
|
const stringifyRequest = r => loaderUtils.stringifyRequest(loaderContext, r)
|
|
@@ -64,6 +64,9 @@ export default (function(){
|
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
computed: {
|
|
67
|
+
originRef() {
|
|
68
|
+
return this.$refs["mpx-button"]
|
|
69
|
+
},
|
|
67
70
|
className() {
|
|
68
71
|
if (this.hoverClass && this.hoverClass !== "none" && this.hover) {
|
|
69
72
|
return this.hoverClass;
|
|
@@ -109,6 +112,7 @@ export default (function(){
|
|
|
109
112
|
};
|
|
110
113
|
const data = {
|
|
111
114
|
class: ["mpx-button", ...this.classNameList],
|
|
115
|
+
ref: "mpx-button",
|
|
112
116
|
...domProps,
|
|
113
117
|
...getInnerListeners(this, {
|
|
114
118
|
mergeAfter,
|
|
@@ -38,11 +38,17 @@ export default {
|
|
|
38
38
|
}
|
|
39
39
|
return h("image", {
|
|
40
40
|
class: "mpx-image",
|
|
41
|
+
ref: "mpx-image",
|
|
41
42
|
src: this.src,
|
|
42
43
|
resize,
|
|
43
44
|
...getInnerListeners(this)
|
|
44
45
|
});
|
|
45
46
|
},
|
|
47
|
+
computed: {
|
|
48
|
+
originRef() {
|
|
49
|
+
return this.$refs["mpx-image"]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
46
52
|
data() {
|
|
47
53
|
return {};
|
|
48
54
|
},
|
|
@@ -9,10 +9,15 @@ export default {
|
|
|
9
9
|
value: {}
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
+
computed: {
|
|
13
|
+
originRef() {
|
|
14
|
+
return this.$refs["mpx-richtext"]
|
|
15
|
+
}
|
|
16
|
+
},
|
|
12
17
|
render () {
|
|
13
|
-
|
|
14
18
|
const data = {
|
|
15
19
|
richText: this.richText,
|
|
20
|
+
ref: "mpx-richtext",
|
|
16
21
|
...getInnerListeners(this)
|
|
17
22
|
}
|
|
18
23
|
return h('text', data)
|
|
@@ -39,11 +39,17 @@ export default {
|
|
|
39
39
|
"text",
|
|
40
40
|
{
|
|
41
41
|
class: classNames,
|
|
42
|
+
ref: "mpx-text",
|
|
42
43
|
...getInnerListeners(this),
|
|
43
44
|
},
|
|
44
45
|
text
|
|
45
46
|
);
|
|
46
47
|
},
|
|
48
|
+
computed: {
|
|
49
|
+
originRef() {
|
|
50
|
+
return this.$refs["mpx-text"]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
47
53
|
data() {
|
|
48
54
|
return {};
|
|
49
55
|
},
|
|
@@ -1918,7 +1918,7 @@ function postProcessTemplate (el) {
|
|
|
1918
1918
|
}
|
|
1919
1919
|
}
|
|
1920
1920
|
|
|
1921
|
-
const isValidMode = makeMap('wx,ali,swan,tt,qq,web,qa,jd,dd,noMode')
|
|
1921
|
+
const isValidMode = makeMap('wx,ali,swan,tt,qq,web,qa,jd,dd,tenon,noMode')
|
|
1922
1922
|
|
|
1923
1923
|
const wrapRE = /^\((.*)\)$/
|
|
1924
1924
|
|
package/lib/tenon/processJSON.js
CHANGED
|
@@ -129,16 +129,12 @@ module.exports = function (json, options, rawCallback) {
|
|
|
129
129
|
defs,
|
|
130
130
|
env
|
|
131
131
|
})
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
callback(err, result, content)
|
|
138
|
-
})
|
|
139
|
-
}
|
|
132
|
+
getJSONContent(parts.json || {}, result, loaderContext, (err, content) => {
|
|
133
|
+
callback(err, result, content)
|
|
134
|
+
})
|
|
135
|
+
} else {
|
|
136
|
+
callback(null, result, content)
|
|
140
137
|
}
|
|
141
|
-
callback(null, result, content)
|
|
142
138
|
},
|
|
143
139
|
(result, content, callback) => {
|
|
144
140
|
try {
|
|
@@ -5,6 +5,7 @@ const normalize = require('../utils/normalize')
|
|
|
5
5
|
const builtInLoaderPath = normalize.lib('built-in-loader')
|
|
6
6
|
const optionProcessorPath = normalize.lib('runtime/optionProcessor')
|
|
7
7
|
const createJSONHelper = require('../json-compiler/helper')
|
|
8
|
+
const createHelpers = require('../helpers')
|
|
8
9
|
const async = require('async')
|
|
9
10
|
const hasOwn = require('../utils/has-own')
|
|
10
11
|
|
|
@@ -89,6 +90,8 @@ module.exports = function (script, options, callback) {
|
|
|
89
90
|
emitError
|
|
90
91
|
})
|
|
91
92
|
|
|
93
|
+
const { getRequire } = createHelpers(loaderContext)
|
|
94
|
+
|
|
92
95
|
const stringifyRequest = r => loaderUtils.stringifyRequest(loaderContext, r)
|
|
93
96
|
// let tabBarPagesMap = {}
|
|
94
97
|
// if (tabBar && tabBarMap) {
|
|
@@ -188,10 +191,14 @@ module.exports = function (script, options, callback) {
|
|
|
188
191
|
if (!isProduction) {
|
|
189
192
|
content += ` global.currentResource = ${JSON.stringify(loaderContext.resourcePath)}\n`
|
|
190
193
|
}
|
|
191
|
-
//
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
:
|
|
194
|
+
// 传递ctorType以补全js内容
|
|
195
|
+
const extraOptions = {
|
|
196
|
+
ctorType,
|
|
197
|
+
lang: script.lang || 'js'
|
|
198
|
+
}
|
|
199
|
+
// 使用 require 引入 script
|
|
200
|
+
content += ` ${getRequire('script', script, extraOptions)}\n`
|
|
201
|
+
|
|
195
202
|
// createApp/Page/Component执行完成后立刻获取当前的option并暂存
|
|
196
203
|
content += ` const currentOption = global.__mpxOptionsMap[${JSON.stringify(moduleId)}]\n`
|
|
197
204
|
// 获取pageConfig
|
|
@@ -247,7 +254,7 @@ module.exports = function (script, options, callback) {
|
|
|
247
254
|
let dynamicPageStr = ''
|
|
248
255
|
async.each(localPagesMap, (pageCfg, callback) => {
|
|
249
256
|
if (typeof pageCfg !== 'string') pageCfg.src = addQuery(pageCfg.src, { tenon: true })
|
|
250
|
-
processPage(pageCfg, loaderContext.context, '', (err, entry, { key }) => {
|
|
257
|
+
processPage(pageCfg, loaderContext.context, '', (err, entry, { key } = {}) => {
|
|
251
258
|
if (err) return callback()
|
|
252
259
|
if (pageSet.has(key)) return callback()
|
|
253
260
|
pageSet.add(key)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.8.25-alpha",
|
|
3
|
+
"version": "2.8.25-alpha.10",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@better-scroll/wheel": "^2.2.1",
|
|
29
29
|
"@better-scroll/zoom": "^2.2.1",
|
|
30
30
|
"@hummer/tenon-dev-server-webpack-plugin": "0.0.2",
|
|
31
|
-
"@hummer/tenon-loader": "^1.
|
|
31
|
+
"@hummer/tenon-loader": "^1.2.0",
|
|
32
32
|
"@hummer/tenon-style-loader": "^0.2.0",
|
|
33
33
|
"acorn-walk": "^7.2.0",
|
|
34
34
|
"async": "^2.6.0",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"engines": {
|
|
86
86
|
"node": ">=14.14.0"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "8644921e89035057c93f648063059b55537c83c3"
|
|
89
89
|
}
|