@dcloudio/vue-cli-plugin-hbuilderx 2.0.2-alpha-3080320230522001 → 2.0.2-alpha-3080520230615001

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.
@@ -18,6 +18,31 @@ const TAGS = [
18
18
  'slider'
19
19
  ]
20
20
 
21
+ function isTextElement (node) {
22
+ return node.type === 1 /* NodeTypes.ELEMENT */ && node.tag === 'text'
23
+ }
24
+
25
+ /*
26
+ 1. 转换 \\n 为 \n
27
+ 2. u-text 下只能有一个文本节点(不支持 children),需要移除子组件并合并文本
28
+ */
29
+ function parseText (el) {
30
+ const children = el.children
31
+ if (children.length > 1) {
32
+ const expression = []
33
+ children.forEach(child => {
34
+ if (child.type === 3) {
35
+ expression.push(`" ${child.text}"`)
36
+ } else if (child.type === 2) {
37
+ expression.push(child.expression.replace(/\\n/g, ''))
38
+ }
39
+ })
40
+ el.children = [{ type: 2, expression: expression.join('+'), tokens: [] }]
41
+ } else if (children.length === 1) {
42
+ children[0].text = children[0].text.replace(/\n/g, '').replace(/\\n/g, '\n')
43
+ }
44
+ }
45
+
21
46
  const modules = [{
22
47
  // render-whole => append="tree"
23
48
  preTransformNode (el, options) {
@@ -54,6 +79,9 @@ const deprecated = {
54
79
  if (process.env.UNI_USING_NVUE_COMPILER) {
55
80
  const wrapperTextTag = function (el, options) {
56
81
  const tag = el.tag
82
+ if (isTextElement(el)) {
83
+ parseText(el)
84
+ }
57
85
  if (tag === 'text' || tag === 'u-text' || tag === 'button') {
58
86
  return
59
87
  }
@@ -146,4 +174,4 @@ module.exports = {
146
174
  compilerOptions: {
147
175
  modules
148
176
  }
149
- }
177
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/vue-cli-plugin-hbuilderx",
3
- "version": "2.0.2-alpha-3080320230522001",
3
+ "version": "2.0.2-alpha-3080520230615001",
4
4
  "description": "HBuilderX plugin for vue-cli 3",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -18,5 +18,5 @@
18
18
  "css": "~2.2.1",
19
19
  "escodegen": "^1.8.1"
20
20
  },
21
- "gitHead": "bf158b4016023a0346959abecf5ad79feb03f2fe"
21
+ "gitHead": "c9d18e44da2ea83e0ca9ed05048bfbad49f0de29"
22
22
  }
@@ -2488,10 +2488,9 @@ function genWeexHandler (handler, options) {
2488
2488
  var code = handler.value;
2489
2489
  var isMethodPath = simplePathRE.test(code);
2490
2490
  var isFunctionExpression = fnExpRE.test(code);
2491
- var isFunctionCall = functionCallRE.test(code);
2492
-
2493
2491
  // TODO: binding this to recyclable event handlers
2494
2492
  if (options.recyclable) {
2493
+ var isFunctionCall = functionCallRE.test(code);
2495
2494
  if (isMethodPath) {
2496
2495
  return ("function($event){this." + code + "()}")
2497
2496
  }