@mpxjs/webpack-plugin 2.8.61 → 2.8.62

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.
@@ -3,7 +3,7 @@ const normalizeTest = require('../normalize-test')
3
3
  const changeKey = require('../change-key')
4
4
  const normalize = require('../../../utils/normalize')
5
5
  const { capitalToHyphen } = require('../../../utils/string')
6
- const { isOriginTag } = require('../../../utils/dom-tag-config')
6
+ const { isOriginTag, isBuildInTag } = require('../../../utils/dom-tag-config')
7
7
 
8
8
  const mpxViewPath = normalize.lib('runtime/components/ali/mpx-view.mpx')
9
9
  const mpxTextPath = normalize.lib('runtime/components/ali/mpx-text.mpx')
@@ -127,7 +127,7 @@ module.exports = function getSpec ({ warn, error }) {
127
127
  }
128
128
 
129
129
  /**
130
- * 将小程序代码中使用的与原生 HTML tag 同名组件进行转化,以解决与原生tag命名冲突问题。
130
+ * 将小程序代码中使用的与原生 HTML tag 或 内建组件 同名的组件进行转化,以解决与原生tag命名冲突问题。
131
131
  * @param {string} type usingComponents
132
132
  * @returns input
133
133
  */
@@ -136,7 +136,7 @@ module.exports = function getSpec ({ warn, error }) {
136
136
  const usingComponents = input[type]
137
137
  if (usingComponents) {
138
138
  Object.keys(usingComponents).forEach(tag => {
139
- if (isOriginTag(tag)) {
139
+ if (isOriginTag(tag) || isBuildInTag(tag)) {
140
140
  usingComponents[`mpx-com-${tag}`] = usingComponents[tag]
141
141
  delete usingComponents[tag]
142
142
  }
@@ -1,9 +1,9 @@
1
- const { isOriginTag } = require('../../../../utils/dom-tag-config')
1
+ const { isOriginTag, isBuildInTag } = require('../../../../utils/dom-tag-config')
2
2
 
3
3
  module.exports = function () {
4
4
  return {
5
5
  waterfall: true,
6
- test: (input) => isOriginTag(input),
6
+ test: (input) => isOriginTag(input) || isBuildInTag(input),
7
7
  // 处理原生tag
8
8
  web (tag, data = {}) {
9
9
  // @see packages/webpack-plugin/lib/platform/json/wx/index.js webHTMLTagProcesser
@@ -97,7 +97,12 @@
97
97
  type: Number,
98
98
  default: 1000
99
99
  },
100
- scrollOptions: Object
100
+ scrollOptions: {
101
+ type: Object,
102
+ default: () => {
103
+ return {}
104
+ }
105
+ },
101
106
  },
102
107
  watch: {
103
108
  x (newVal) {
@@ -30,7 +30,12 @@
30
30
  type: [Number, String],
31
31
  default: 0
32
32
  },
33
- scrollOptions: Object,
33
+ scrollOptions: {
34
+ type: Object,
35
+ default: () => {
36
+ return {}
37
+ }
38
+ },
34
39
  updateRefresh: {
35
40
  type: Boolean,
36
41
  default: true
@@ -42,7 +42,12 @@
42
42
  },
43
43
  previousMargin: String,
44
44
  nextMargin: String,
45
- scrollOptions: Object
45
+ scrollOptions: {
46
+ type: Object,
47
+ default: () => {
48
+ return {}
49
+ }
50
+ },
46
51
  },
47
52
  data () {
48
53
  return {
@@ -68,6 +68,19 @@ const isNativeMiniTag = makeMap(
68
68
  'open-data,native-component,aria-component,page-meta'
69
69
  )
70
70
 
71
+ /**
72
+ * 是否为mpx内置组件
73
+ * collected from packages/webpack-plugin/lib/runtime/components/web/
74
+ */
75
+ const isBuildInTag = makeMap(
76
+ 'mpx-image,mpx-picker-view,mpx-slider,mpx-textarea,mpx-input,mpx-picker,' +
77
+ 'mpx-swiper-item,mpx-video,mpx-button,mpx-keep-alive,mpx-progress,' +
78
+ 'mpx-swiper,mpx-view,mpx-checkbox-group,mpx-movable-area,mpx-radio-group,' +
79
+ 'mpx-switch,mpx-web-view,mpx-checkbox,mpx-movable-view,mpx-radio,' +
80
+ 'mpx-tab-bar-container,mpx-form,mpx-navigator,mpx-rich-text,mpx-tab-bar,' +
81
+ 'mpx-icon,mpx-picker-view-column,mpx-scroll-view,mpx-text'
82
+ )
83
+
71
84
  const isSpace = makeMap('ensp,emsp,nbsp')
72
85
 
73
86
  const isContWidth = makeMap('col,colgroup,img,table,td,th,tr')
@@ -92,6 +105,7 @@ module.exports = {
92
105
  isVoidTag,
93
106
  isNonPhrasingTag,
94
107
  isRichTextTag,
108
+ isBuildInTag,
95
109
  isUnaryTag,
96
110
  isSpace,
97
111
  isContWidth,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.8.61",
3
+ "version": "2.8.62",
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": "f393ffc439f21b24f5f09a65ef99db20b145e19a"
85
+ "gitHead": "968ecb02c86fcd5e9f8f827645907ea4225266ff"
86
86
  }