@dcloudio/vue-cli-plugin-uni 2.0.1-alpha-33820220118002 → 2.0.1-alpha-34020220301001

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.
@@ -10,8 +10,9 @@ function isFunction (expr) {
10
10
  try {
11
11
  const body = parser.parse(`(${expr})`).program.body[0]
12
12
  const expression = body.expression
13
- return t.isFunctionDeclaration(body) || t.isArrowFunctionExpression(expression) || t.isFunctionExpression(expression)
14
- } catch (error) { }
13
+ return t.isFunctionDeclaration(body) || t.isArrowFunctionExpression(expression) || t.isFunctionExpression(
14
+ expression)
15
+ } catch (error) {}
15
16
  }
16
17
 
17
18
  function processEvent (expr, filterModules) {
@@ -80,31 +81,39 @@ module.exports = {
80
81
  })
81
82
  }
82
83
  }
83
- if (el.events) {
84
+ if (el.events || el.nativeEvents) {
84
85
  filterModules = filterModules || []
85
86
  const {
86
87
  events: eventsMap
87
88
  } = deprecated
88
89
  // const warnLogs = new Set()
89
- Object.keys(el.events).forEach(name => {
90
- // 过时事件类型转换
91
- if (eventsMap[name]) {
92
- el.events[eventsMap[name]] = el.events[name]
93
- delete el.events[name]
94
- // warnLogs.add(`警告:事件${name}已过时,推荐使用${eventsMap[name]}代替`)
95
- name = eventsMap[name]
96
- }
97
-
98
- const handlers = el.events[name]
99
- if (Array.isArray(handlers)) {
100
- handlers.forEach(handler => {
101
- handler.value = processEvent(handler.value, filterModules)
102
- })
103
- } else {
104
- handlers.value = processEvent(handlers.value, filterModules)
105
- }
106
- })
90
+ normalizeEvent(el.events, eventsMap, filterModules)
91
+ normalizeEvent(el.nativeEvents, eventsMap, filterModules)
107
92
  }
108
93
  }
109
94
  }]
110
95
  }
96
+
97
+ function normalizeEvent (events, eventsMap, filterModules) {
98
+ if (!events) {
99
+ return
100
+ }
101
+ Object.keys(events).forEach(name => {
102
+ // 过时事件类型转换
103
+ if (eventsMap[name]) {
104
+ events[eventsMap[name]] = events[name]
105
+ delete events[name]
106
+ // warnLogs.add(`警告:事件${name}已过时,推荐使用${eventsMap[name]}代替`)
107
+ name = eventsMap[name]
108
+ }
109
+
110
+ const handlers = events[name]
111
+ if (Array.isArray(handlers)) {
112
+ handlers.forEach(handler => {
113
+ handler.value = processEvent(handler.value, filterModules)
114
+ })
115
+ } else {
116
+ handlers.value = processEvent(handlers.value, filterModules)
117
+ }
118
+ })
119
+ }
package/lib/mp/index.js CHANGED
@@ -202,13 +202,13 @@ module.exports = {
202
202
  // 使用外层依赖的版本
203
203
  alias['regenerator-runtime'] = require.resolve('regenerator-runtime')
204
204
  const output = {
205
- pathinfo: process.env.UNI_MINIMIZE !== 'true',
205
+ pathinfo: true,
206
206
  filename: '[name].js',
207
207
  chunkFilename: '[id].js',
208
208
  globalObject: process.env.UNI_PLATFORM === 'mp-alipay' ? 'my' : 'global'
209
209
  // sourceMapFilename: '../.sourcemap/' + process.env.UNI_PLATFORM + '/[name].js.map'
210
210
  }
211
- if (process.env.UNI_MINIMIZE === 'true' && process.env.NODE_ENV === 'development') {
211
+ if (process.env.NODE_ENV === 'production' || process.env.UNI_MINIMIZE === 'true') {
212
212
  output.pathinfo = false
213
213
  }
214
214
  return {
@@ -320,4 +320,4 @@ module.exports = {
320
320
  webpackConfig.plugins.delete('preload')
321
321
  webpackConfig.plugins.delete('prefetch')
322
322
  }
323
- }
323
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/vue-cli-plugin-uni",
3
- "version": "2.0.1-alpha-33820220118002",
3
+ "version": "2.0.1-alpha-34020220301001",
4
4
  "description": "uni-app plugin for vue-cli 3",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -17,7 +17,7 @@
17
17
  "author": "fxy060608",
18
18
  "license": "Apache-2.0",
19
19
  "dependencies": {
20
- "@dcloudio/uni-stat": "^2.0.1-alpha-33820220118002",
20
+ "@dcloudio/uni-stat": "^2.0.1-alpha-34020220301001",
21
21
  "buffer-json": "^2.0.0",
22
22
  "clone-deep": "^4.0.1",
23
23
  "copy-webpack-plugin": "^5.1.1",
@@ -39,5 +39,5 @@
39
39
  "wrap-loader": "^0.2.0",
40
40
  "xregexp": "4.0.0"
41
41
  },
42
- "gitHead": "c109a58cdc4ecf3b49bf256fbec6d570c3c110e1"
42
+ "gitHead": "01fc506e703005383798e2ff0f32e92f20d3f910"
43
43
  }
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * Vue.js v2.6.11
3
- * (c) 2014-2021 Evan You
3
+ * (c) 2014-2022 Evan You
4
4
  * Released under the MIT License.
5
5
  */
6
6
  'use strict';
@@ -6784,7 +6784,8 @@ function updateWxsProps(oldVnode, vnode) {
6784
6784
  context.$getComponentDescriptor(context, true),
6785
6785
  vnode.elm.__vue__.$getComponentDescriptor(vnode.elm.__vue__, false)
6786
6786
  );
6787
- }, {
6787
+ }, {
6788
+ immediate: true, // 当 prop 的值被设置 WXS 函数就会触发,而不只是值发生改变,所以在页面初始化的时候会调用一次 WxsPropObserver 的函数
6788
6789
  deep: true
6789
6790
  });
6790
6791
  });