@mpxjs/webpack-plugin 2.8.25-alpha.1 → 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.
@@ -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
- return `getRelativePath(currentURL, ${JSON.stringify(resolved)}) + '.js'`
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
- this._module.addPresentationalDependency(new AppEntryDependency(resourcePath, appName))
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)
@@ -263,6 +263,12 @@ module.exports = function getSpec ({ warn, error }) {
263
263
  name: 'ref',
264
264
  value: `__mpx_ref_${value}__`
265
265
  }
266
+ },
267
+ tenon ({ value }) {
268
+ return {
269
+ name: 'ref',
270
+ value: `${value}`
271
+ }
266
272
  }
267
273
  },
268
274
  {
@@ -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)
@@ -72,6 +72,9 @@ export default {
72
72
  return {};
73
73
  },
74
74
  computed: {
75
+ originRef() {
76
+ return this.$refs["scroll"]
77
+ },
75
78
  _scrollTop() {
76
79
  // return 1
77
80
  return processSize(this.scrollTop);
@@ -22,6 +22,11 @@ export default {
22
22
  default: "#04BE02",
23
23
  },
24
24
  },
25
+ computed: {
26
+ originRef() {
27
+ return this.$refs["switch"]
28
+ }
29
+ },
25
30
  watch: {
26
31
  checked(newVal) {
27
32
  this.switchChecked = newVal;
@@ -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
  },
@@ -32,7 +32,6 @@ export default {
32
32
  default: -1,
33
33
  },
34
34
  },
35
-
36
35
  computed: {
37
36
  originRef() {
38
37
  return this.$refs["mpx-textarea"]
@@ -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
 
@@ -129,16 +129,12 @@ module.exports = function (json, options, rawCallback) {
129
129
  defs,
130
130
  env
131
131
  })
132
- const json = parts.json || {}
133
- if (json.content) {
134
- content = json.content
135
- } else if (json.src) {
136
- return getJSONContent(json || {}, loaderContext, (err, content) => {
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 {
@@ -254,7 +254,7 @@ module.exports = function (script, options, callback) {
254
254
  let dynamicPageStr = ''
255
255
  async.each(localPagesMap, (pageCfg, callback) => {
256
256
  if (typeof pageCfg !== 'string') pageCfg.src = addQuery(pageCfg.src, { tenon: true })
257
- processPage(pageCfg, loaderContext.context, '', (err, entry, { key }) => {
257
+ processPage(pageCfg, loaderContext.context, '', (err, entry, { key } = {}) => {
258
258
  if (err) return callback()
259
259
  if (pageSet.has(key)) return callback()
260
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.1",
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.1.0",
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": "0d932ec0de2bf893ac37811b9280c1c693e644ef"
88
+ "gitHead": "8644921e89035057c93f648063059b55537c83c3"
89
89
  }