@aiot-toolkit/parser 2.0.5-widget-provider-beta.2 → 2.0.5

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.
Files changed (49) hide show
  1. package/README.md +11 -11
  2. package/lib/utils/ParserUtil.js +15 -15
  3. package/lib/ux/config/ExtensionConfig.js +2 -2
  4. package/lib/ux/config/FeatureConfig.js +19 -19
  5. package/lib/ux/config/vela/ElementConfig.js +0 -8
  6. package/lib/ux/config/vela/StyleAttributeConfig.js +134 -88
  7. package/lib/ux/enum/StyleSelectorType.js +6 -6
  8. package/lib/ux/enum/TemplateNodeType.js +2 -2
  9. package/lib/ux/enum/android/StyleSelectorName.js +2 -2
  10. package/lib/ux/interface/IUxAst.d.ts +2 -0
  11. package/lib/ux/parser/ScriptParser.js +2 -2
  12. package/lib/ux/parser/StyleParser.js +79 -72
  13. package/lib/ux/parser/TemplateValueParser.js +49 -49
  14. package/lib/ux/parser/UxParser.js +18 -12
  15. package/lib/ux/translate/android/StyleToTypescript.js +51 -51
  16. package/lib/ux/translate/android/TemplateToTypescript.js +51 -51
  17. package/lib/ux/translate/android/UxToTypescript.js +14 -14
  18. package/lib/ux/translate/android/attributeTranslate/ForTranslate.js +17 -17
  19. package/lib/ux/translate/android/attributeTranslate/IfTranslate.js +9 -9
  20. package/lib/ux/translate/vela/ScriptToTypescript.js +10 -10
  21. package/lib/ux/translate/vela/StyleToTypescript.js +10 -10
  22. package/lib/ux/translate/vela/TemplateToTypescript.js +74 -74
  23. package/lib/ux/translate/vela/TranslateCache.js +2 -2
  24. package/lib/ux/translate/vela/UxToTypescript.js +6 -6
  25. package/lib/ux/translate/vela/VelaContext.js +2 -2
  26. package/lib/ux/translate/vela/plugins/e2e.js +63 -62
  27. package/lib/ux/translate/vela/plugins/startPage.js +1 -1
  28. package/lib/ux/translate/vela/protobuf/BinaryPlugin.js +172 -172
  29. package/lib/ux/translate/vela/protobuf/protobuf.js +235 -235
  30. package/lib/ux/translate/vela/protobuf/protobufControl.js +159 -159
  31. package/lib/ux/translate/vela/protobuf/vdom_pb.js +2374 -2374
  32. package/lib/ux/translate/vela/runtime/velaTestLibrary.js +104 -104
  33. package/lib/ux/translate/vela/utils/AttributeConfig.js +15 -15
  34. package/lib/ux/translate/vela/utils/ExtendedBoxStyle.js +38 -38
  35. package/lib/ux/translate/vela/utils/SourceMapUtil.d.ts +0 -4
  36. package/lib/ux/translate/vela/utils/SourceMapUtil.js +30 -36
  37. package/lib/ux/translate/vela/utils/TemplateUtil.js +180 -180
  38. package/lib/ux/translate/vela/wrap/CbTranslate.js +8 -8
  39. package/lib/ux/translate/vela/wrap/CfTranslate.js +14 -14
  40. package/lib/ux/translate/vela/wrap/CiTranslate.js +11 -11
  41. package/lib/ux/utils/BabelUtil.js +35 -35
  42. package/lib/ux/utils/ElementConfigUtil.js +24 -24
  43. package/lib/ux/utils/StyleMapUtil.js +15 -15
  44. package/lib/ux/utils/StyleUtil.d.ts +1 -1
  45. package/lib/ux/utils/StyleUtil.js +192 -248
  46. package/lib/ux/utils/UxUtil.js +32 -32
  47. package/lib/ux/validate/ElementValidate.js +2 -2
  48. package/lib/ux/validate/UxFileValidate.js +2 -2
  49. package/package.json +4 -4
@@ -25,11 +25,11 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
25
25
  const {
26
26
  validate: CsstreeValidator
27
27
  } = require('csstree-validator');
28
- /**
29
- * StyleParser
30
- * 1. 根据语言类型分别转为CSS样式
31
- * 2. 用CSSTREE解析CSS内容
32
- * 3. 把解析结果转换为目标格式
28
+ /**
29
+ * StyleParser
30
+ * 1. 根据语言类型分别转为CSS样式
31
+ * 2. 用CSSTREE解析CSS内容
32
+ * 3. 把解析结果转换为目标格式
33
33
  */
34
34
  class StyleParser {
35
35
  QUICKAPP_CONFIG = 'quickapp.config.js';
@@ -94,7 +94,7 @@ class StyleParser {
94
94
 
95
95
  // 解析错误全部抛出
96
96
  errors = this.printError('parserError', errors);
97
- errors.push(..._StyleUtil.default.collectSyntaxError(CsstreeValidator(originAst, fileName), this.styleMapUtil, fileExt !== '.css', this.styleLineOffset));
97
+ errors.push(..._StyleUtil.default.collectSyntaxError(CsstreeValidator(originAst, fileName)));
98
98
  // 校验错误打印warn
99
99
  this.printError('validateError', errors);
100
100
  const cssAst = {
@@ -117,17 +117,17 @@ class StyleParser {
117
117
  };
118
118
  }
119
119
 
120
- /**
121
- * 获取用户配置的 alias
122
- * @returns
120
+ /**
121
+ * 获取用户配置的 alias
122
+ * @returns
123
123
  */
124
124
  getAlias() {
125
125
  return _sharedUtils.CommonUtil.requireModule(_path.default.join(this.options.projectPath, this.QUICKAPP_CONFIG))?.webpack?.resolve?.alias || {};
126
126
  }
127
- /**
128
- * 将Less样式转为CSS
129
- * @param sourceContent
130
- * @returns
127
+ /**
128
+ * 将Less样式转为CSS
129
+ * @param sourceContent
130
+ * @returns
131
131
  */
132
132
  lessToCss(sourceContent) {
133
133
  let CSSCode = '';
@@ -167,10 +167,10 @@ class StyleParser {
167
167
  });
168
168
  });
169
169
  }
170
- /**
171
- * 将Scss样式转为CSS
172
- * @param sourceContent
173
- * @returns
170
+ /**
171
+ * 将Scss样式转为CSS
172
+ * @param sourceContent
173
+ * @returns
174
174
  */
175
175
  async scssToCss(sourceContent, isSass) {
176
176
  const {
@@ -206,11 +206,11 @@ class StyleParser {
206
206
  });
207
207
  }
208
208
  }
209
- /**
210
- * 使用postcss做css样式转换
211
- * 例如:将@import 转换为引入的内容
212
- * @param sourceContent
213
- * @returns
209
+ /**
210
+ * 使用postcss做css样式转换
211
+ * 例如:将@import 转换为引入的内容
212
+ * @param sourceContent
213
+ * @returns
214
214
  */
215
215
  async parserCss(sourceContent) {
216
216
  const {
@@ -263,12 +263,12 @@ class StyleParser {
263
263
  }
264
264
  }
265
265
  }
266
- /**
267
- * 解析CSS语法树的上的节点
268
- * 1. 将节点按照rule节点、Atrule节点、没有prelude属性的Atrule节点区分
269
- * 2. 节点内容将按照定义的IRuleType类型返回
270
- * @param sourceNode
271
- * @returns
266
+ /**
267
+ * 解析CSS语法树的上的节点
268
+ * 1. 将节点按照rule节点、Atrule节点、没有prelude属性的Atrule节点区分
269
+ * 2. 节点内容将按照定义的IRuleType类型返回
270
+ * @param sourceNode
271
+ * @returns
272
272
  */
273
273
  parserNode(sourceNode) {
274
274
  let targetNode = {
@@ -297,10 +297,10 @@ class StyleParser {
297
297
  }
298
298
  return targetNode;
299
299
  }
300
- /**
301
- * 解析rule节点
302
- * @param sourceNode
303
- * @returns 返回预定义的RuleType结构
300
+ /**
301
+ * 解析rule节点
302
+ * @param sourceNode
303
+ * @returns 返回预定义的RuleType结构
304
304
  */
305
305
  paserRuleNode(sourceNode) {
306
306
  const targetNode = {
@@ -319,10 +319,10 @@ class StyleParser {
319
319
  targetNode.block = this.parserBlock(block);
320
320
  return targetNode;
321
321
  }
322
- /**
323
- * 解析一般的Atrule节点
324
- * @param sourceNode
325
- * @returns 返回预定义的AtRuleType结构
322
+ /**
323
+ * 解析一般的Atrule节点
324
+ * @param sourceNode
325
+ * @returns 返回预定义的AtRuleType结构
326
326
  */
327
327
  paserAtRuleNode(sourceNode) {
328
328
  const targetNode = {
@@ -365,11 +365,11 @@ class StyleParser {
365
365
  }
366
366
  return targetNode;
367
367
  }
368
- /**
369
- * 解析没有prelude属性的Atrule节点
370
- * 1. 处理block中的属性和值的内容
371
- * @param sourceNode
372
- * @returns 返回预定义的NoPreludeAtRule结构
368
+ /**
369
+ * 解析没有prelude属性的Atrule节点
370
+ * 1. 处理block中的属性和值的内容
371
+ * @param sourceNode
372
+ * @returns 返回预定义的NoPreludeAtRule结构
373
373
  */
374
374
  parserNoPreludeAtRule(sourceNode) {
375
375
  const targetNode = {
@@ -389,12 +389,12 @@ class StyleParser {
389
389
  targetNode.block = this.parserBlock(block);
390
390
  return targetNode;
391
391
  }
392
- /**
393
- * 解析prelude节点
394
- * 1. SelectorList时,返回选择器列表
395
- * 2. AtrulePrelude时,返回条件字符串列表
396
- * @param nodeList
397
- * @returns
392
+ /**
393
+ * 解析prelude节点
394
+ * 1. SelectorList时,返回选择器列表
395
+ * 2. AtrulePrelude时,返回条件字符串列表
396
+ * @param nodeList
397
+ * @returns
398
398
  */
399
399
  parserPrelude(sourceNode) {
400
400
  let targetList = [];
@@ -434,17 +434,17 @@ class StyleParser {
434
434
  }
435
435
  return targetList;
436
436
  }
437
- /**
438
- * 解析block结构
439
- * 生成属性name和value组成的对象列表
440
- * [
441
- * {
442
- * name: '',
443
- * value: [{value:'', unit:''}, ...]
444
- * }, ...
445
- * ]
446
- * @param sourceNode
447
- * @returns
437
+ /**
438
+ * 解析block结构
439
+ * 生成属性name和value组成的对象列表
440
+ * [
441
+ * {
442
+ * name: '',
443
+ * value: [{value:'', unit:''}, ...]
444
+ * }, ...
445
+ * ]
446
+ * @param sourceNode
447
+ * @returns
448
448
  */
449
449
  parserBlock(sourceNode) {
450
450
  const targetList = [];
@@ -470,11 +470,11 @@ class StyleParser {
470
470
  });
471
471
  return targetList;
472
472
  }
473
- /**
474
- * 解析value属性
475
- * 1. 若value对象有'Children'属性则表示存在值,否则返回空列表
476
- * 2. 循环Children列表,遇到操作符、Url做特殊处理
477
- * 3. 其他子项,需要取出value和unit内容
473
+ /**
474
+ * 解析value属性
475
+ * 1. 若value对象有'Children'属性则表示存在值,否则返回空列表
476
+ * 2. 循环Children列表,遇到操作符、Url做特殊处理
477
+ * 3. 其他子项,需要取出value和unit内容
478
478
  */
479
479
  parserValue(nodeName, node) {
480
480
  const {
@@ -598,18 +598,25 @@ class StyleParser {
598
598
  const sourceCode = error.source ? [`, source code:`, {
599
599
  word: `${error.source}`
600
600
  }] : [];
601
+ const position = this.styleMapUtil.transfromLocToPosition({
602
+ start: {
603
+ line: error.startLine,
604
+ column: error.startCol,
605
+ offset: 0
606
+ },
607
+ end: {
608
+ line: error.endLine,
609
+ column: error.endCol,
610
+ offset: 0
611
+ },
612
+ source: error.source
613
+ });
614
+ position.startColumn++;
615
+ position.endColumn++;
601
616
  onLog({
602
617
  level: sourceCodeStyle,
603
618
  filePath,
604
- position: {
605
- pos: error.startOffset,
606
- end: error.endOffset,
607
- // 减1的原因是 <style>\n <style>的位置和 css 的第1行重合,所以要去掉重合的1行
608
- startLine: error.startLine + this.styleLineOffset - 1,
609
- startColumn: error.startCol,
610
- endLine: error.endLine + this.styleLineOffset - 1,
611
- endColumn: error.endCol
612
- },
619
+ position,
613
620
  message: [{
614
621
  word: error.message
615
622
  }, ...sourceCode]
@@ -16,55 +16,55 @@ var TemplateValueParseState = /*#__PURE__*/function (TemplateValueParseState) {
16
16
  return TemplateValueParseState;
17
17
  }(TemplateValueParseState || {});
18
18
  class TemplateValueParser {
19
- /**
20
- * 解析模板字符串
21
- *
22
- * 概述:模板字符串包含两种类型--文字类型和代码类型,代码类型被包裹在 {{}}中
23
- * 例如 a{{b}}c,[{value:'a', type:'文字类型'}, {value:'b', type:'代码类型'}, {value:'c', type:'文字类型'}]
24
- *
25
- * @example `new TemplateValueParser().parse('a{{b}}c')`
26
- *
27
- * 解析过程
28
- * 1. 初始
29
- * a. 状态为文字状态
30
- * b. 定义变量`bracketCounter`,记录'{'的数量
31
- * b. 遍历字符串进行解析
32
- * 2. 文字状态
33
- * a. 遇到 { 且下个字符也是 {, 则:
34
- * a1. 如果当前值有值,则添加到结果列表中(文本类型)
35
- * a2. 循环序号+1
36
- * a4. bracketCounter重置为0
37
- * a3. 进入代码状态
38
- * b. 否则,字符添加到当前值中
39
- * 3. 代码状态
40
- * a. 遇到 }
41
- * c1. 如计数为0
42
- * c11. 判断后面的字符是否为}
43
- * c111. 如果是,如果当前值有值,则添加到结果列表中(代码类型)并进入`文字状态`
44
- * c112. 否则,字符添加到当前值
45
- * c2. 否则,计数减1,但最小值为0
46
- * b. 遇到 {
47
- * b1. 如果下一个字符也是{,则报错
48
- * b2. 否则计数+1, 并把字符添加到当前值-因为js代码会有{},例如
49
- * ```
50
- *
51
- * {{()=>{}}}
52
- * 12 3456
53
- *
54
- * // 遇到3时,是{,计数加1
55
- * // 遇到4时,是}, 计数减1, 此时计数为0
56
- * // 遇到5时,是{,计数为0,则判断下一个字符也是}, jscode 状态结束
57
- * ```
58
- * c. 如果是"或', 进入`代码_字符串`状态,同时字符添加到当前值
59
- * d. 否则,字符添加到当前值
60
- * 4. 代码_字符串
61
- * a. 字符添加到当前值中
62
- * c. 如果是"或', 则:退回到`代码状态`
63
- * 5. 遇到最后一个字符
64
- * a. 如果仍处于代码状态,则把`{{ + 当前值`以文字类型添加到结果列表中. 示例:a{{b --> [a, {{b]
65
- * b. 否则,把`当前值`以`文字类型`添加到结果列表中
66
- * 6. 返回结果列表
67
- * @param template
19
+ /**
20
+ * 解析模板字符串
21
+ *
22
+ * 概述:模板字符串包含两种类型--文字类型和代码类型,代码类型被包裹在 {{}}中
23
+ * 例如 a{{b}}c,[{value:'a', type:'文字类型'}, {value:'b', type:'代码类型'}, {value:'c', type:'文字类型'}]
24
+ *
25
+ * @example `new TemplateValueParser().parse('a{{b}}c')`
26
+ *
27
+ * 解析过程
28
+ * 1. 初始
29
+ * a. 状态为文字状态
30
+ * b. 定义变量`bracketCounter`,记录'{'的数量
31
+ * b. 遍历字符串进行解析
32
+ * 2. 文字状态
33
+ * a. 遇到 { 且下个字符也是 {, 则:
34
+ * a1. 如果当前值有值,则添加到结果列表中(文本类型)
35
+ * a2. 循环序号+1
36
+ * a4. bracketCounter重置为0
37
+ * a3. 进入代码状态
38
+ * b. 否则,字符添加到当前值中
39
+ * 3. 代码状态
40
+ * a. 遇到 }
41
+ * c1. 如计数为0
42
+ * c11. 判断后面的字符是否为}
43
+ * c111. 如果是,如果当前值有值,则添加到结果列表中(代码类型)并进入`文字状态`
44
+ * c112. 否则,字符添加到当前值
45
+ * c2. 否则,计数减1,但最小值为0
46
+ * b. 遇到 {
47
+ * b1. 如果下一个字符也是{,则报错
48
+ * b2. 否则计数+1, 并把字符添加到当前值-因为js代码会有{},例如
49
+ * ```
50
+ *
51
+ * {{()=>{}}}
52
+ * 12 3456
53
+ *
54
+ * // 遇到3时,是{,计数加1
55
+ * // 遇到4时,是}, 计数减1, 此时计数为0
56
+ * // 遇到5时,是{,计数为0,则判断下一个字符也是}, jscode 状态结束
57
+ * ```
58
+ * c. 如果是"或', 进入`代码_字符串`状态,同时字符添加到当前值
59
+ * d. 否则,字符添加到当前值
60
+ * 4. 代码_字符串
61
+ * a. 字符添加到当前值中
62
+ * c. 如果是"或', 则:退回到`代码状态`
63
+ * 5. 遇到最后一个字符
64
+ * a. 如果仍处于代码状态,则把`{{ + 当前值`以文字类型添加到结果列表中. 示例:a{{b --> [a, {{b]
65
+ * b. 否则,把`当前值`以`文字类型`添加到结果列表中
66
+ * 6. 返回结果列表
67
+ * @param template
68
68
  */
69
69
  parse(template) {
70
70
  let state = TemplateValueParseState.IN_CHAR;
@@ -14,8 +14,8 @@ var _StyleParser = _interopRequireDefault(require("./StyleParser"));
14
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
16
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
- /**
18
- * UxParser
17
+ /**
18
+ * UxParser
19
19
  */
20
20
  class UxParser {
21
21
  constructor(options, compilerOption, globalVar, collectImageResource) {
@@ -112,7 +112,9 @@ class UxParser {
112
112
  styleContent: []
113
113
  },
114
114
  import: [],
115
- data: {}
115
+ data: {},
116
+ comments: [],
117
+ texts: []
116
118
  };
117
119
  const uxAst = parse5.parseFragment(content, {
118
120
  scriptingEnabled: false,
@@ -179,6 +181,10 @@ class UxParser {
179
181
  ...childNode
180
182
  };
181
183
  break;
184
+ case '#comment':
185
+ ast.comments.push(childNode);
186
+ case '#text':
187
+ ast.texts.push(childNode);
182
188
  default:
183
189
  break;
184
190
  }
@@ -190,11 +196,11 @@ class UxParser {
190
196
  };
191
197
  }
192
198
 
193
- /**
194
- * 验证内容
195
- * 1. template:
196
- * a. 最多1个
197
- * b. 子元素有且仅有1个,不能是 block
199
+ /**
200
+ * 验证内容
201
+ * 1. template:
202
+ * a. 最多1个
203
+ * b. 子元素有且仅有1个,不能是 block
198
204
  */
199
205
  validateContent(childNodes) {
200
206
  let result = true;
@@ -260,10 +266,10 @@ class UxParser {
260
266
 
261
267
  return result;
262
268
  }
263
- /**
264
- * 解析import内容
265
- * @param sourceNode
266
- * @param ast
269
+ /**
270
+ * 解析import内容
271
+ * @param sourceNode
272
+ * @param ast
267
273
  */
268
274
  parserImport(sourceNode, ast) {
269
275
  const {
@@ -9,8 +9,8 @@ var _StyleSelectorType = require("../../enum/StyleSelectorType");
9
9
  var _StyleSelectorName = _interopRequireDefault(require("../../enum/android/StyleSelectorName"));
10
10
  var _StyleUtil = _interopRequireDefault(require("../../utils/StyleUtil"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- /**
13
- * StyleToTypescript
12
+ /**
13
+ * StyleToTypescript
14
14
  */
15
15
  class StyleToTypescript {
16
16
  constructor(options, compilerOption) {
@@ -28,13 +28,13 @@ class StyleToTypescript {
28
28
  };
29
29
  }
30
30
 
31
- /**
32
- * 转换节点列表
33
- *
34
- * 1. 对于任一节点,根据类型做不同的转换
35
- * 2. 转换结果和已有的结果进行合并
36
- * @param nodes
37
- * @returns
31
+ /**
32
+ * 转换节点列表
33
+ *
34
+ * 1. 对于任一节点,根据类型做不同的转换
35
+ * 2. 转换结果和已有的结果进行合并
36
+ * @param nodes
37
+ * @returns
38
38
  */
39
39
  translateNodes(nodes) {
40
40
  const result = {};
@@ -58,14 +58,14 @@ class StyleToTypescript {
58
58
  return result;
59
59
  }
60
60
 
61
- /**
62
- * 合并样式
63
- *
64
- * 1. media: 合并数组
65
- * 2. 其它(fontface, keyframes, 普通样式):合并对象
66
- * @param currentStyle
67
- * @param newStyle
68
- * @returns
61
+ /**
62
+ * 合并样式
63
+ *
64
+ * 1. media: 合并数组
65
+ * 2. 其它(fontface, keyframes, 普通样式):合并对象
66
+ * @param currentStyle
67
+ * @param newStyle
68
+ * @returns
69
69
  */
70
70
  mergeStyle(currentStyle, newStyle) {
71
71
  for (const styleName in newStyle) {
@@ -84,11 +84,11 @@ class StyleToTypescript {
84
84
  }
85
85
  }
86
86
 
87
- /**
88
- * 转换@ 开头的样式
89
- *
90
- * @param node
91
- * @returns
87
+ /**
88
+ * 转换@ 开头的样式
89
+ *
90
+ * @param node
91
+ * @returns
92
92
  */
93
93
  translateAtRule(node) {
94
94
  const {
@@ -107,10 +107,10 @@ class StyleToTypescript {
107
107
  }
108
108
  }
109
109
 
110
- /**
111
- * 转换keyframe
112
- * @param node
113
- * @returns
110
+ /**
111
+ * 转换keyframe
112
+ * @param node
113
+ * @returns
114
114
  */
115
115
  translateKeyFrames(node) {
116
116
  const result = {
@@ -128,14 +128,14 @@ class StyleToTypescript {
128
128
  return result;
129
129
  }
130
130
 
131
- /**
132
- * 转换 @font-face
133
- *
134
- * 1. 以font-family 为key
135
- * 2. 额外生成fontName=fontFamily fontSrc=src
136
- *
137
- * @param node
138
- * @returns
131
+ /**
132
+ * 转换 @font-face
133
+ *
134
+ * 1. 以font-family 为key
135
+ * 2. 额外生成fontName=fontFamily fontSrc=src
136
+ *
137
+ * @param node
138
+ * @returns
139
139
  */
140
140
  translateFontFace(node) {
141
141
  const {
@@ -172,14 +172,14 @@ class StyleToTypescript {
172
172
  };
173
173
  }
174
174
 
175
- /**
176
- * 转换 @media
177
- *
178
- * 1. 以"@MEDIA"为键
179
- * 2. 以条件为 `condition` 的值
180
- * 3. 递归 translateNodes 转换其中的内容
181
- * @param node
182
- * @returns
175
+ /**
176
+ * 转换 @media
177
+ *
178
+ * 1. 以"@MEDIA"为键
179
+ * 2. 以条件为 `condition` 的值
180
+ * 3. 递归 translateNodes 转换其中的内容
181
+ * @param node
182
+ * @returns
183
183
  */
184
184
  translateMedia(node) {
185
185
  const {
@@ -212,15 +212,15 @@ class StyleToTypescript {
212
212
  };
213
213
  }
214
214
 
215
- /**
216
- * 转换常规样式
217
- * ```
218
- * .a .b {
219
- * color: red;
220
- * }
221
- * ```
222
- * @param node
223
- * @returns
215
+ /**
216
+ * 转换常规样式
217
+ * ```
218
+ * .a .b {
219
+ * color: red;
220
+ * }
221
+ * ```
222
+ * @param node
223
+ * @returns
224
224
  */
225
225
  translateRule(node) {
226
226
  const {