@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.
- package/README.md +11 -11
- package/lib/utils/ParserUtil.js +15 -15
- package/lib/ux/config/ExtensionConfig.js +2 -2
- package/lib/ux/config/FeatureConfig.js +19 -19
- package/lib/ux/config/vela/ElementConfig.js +0 -8
- package/lib/ux/config/vela/StyleAttributeConfig.js +134 -88
- package/lib/ux/enum/StyleSelectorType.js +6 -6
- package/lib/ux/enum/TemplateNodeType.js +2 -2
- package/lib/ux/enum/android/StyleSelectorName.js +2 -2
- package/lib/ux/interface/IUxAst.d.ts +2 -0
- package/lib/ux/parser/ScriptParser.js +2 -2
- package/lib/ux/parser/StyleParser.js +79 -72
- package/lib/ux/parser/TemplateValueParser.js +49 -49
- package/lib/ux/parser/UxParser.js +18 -12
- package/lib/ux/translate/android/StyleToTypescript.js +51 -51
- package/lib/ux/translate/android/TemplateToTypescript.js +51 -51
- package/lib/ux/translate/android/UxToTypescript.js +14 -14
- package/lib/ux/translate/android/attributeTranslate/ForTranslate.js +17 -17
- package/lib/ux/translate/android/attributeTranslate/IfTranslate.js +9 -9
- package/lib/ux/translate/vela/ScriptToTypescript.js +10 -10
- package/lib/ux/translate/vela/StyleToTypescript.js +10 -10
- package/lib/ux/translate/vela/TemplateToTypescript.js +74 -74
- package/lib/ux/translate/vela/TranslateCache.js +2 -2
- package/lib/ux/translate/vela/UxToTypescript.js +6 -6
- package/lib/ux/translate/vela/VelaContext.js +2 -2
- package/lib/ux/translate/vela/plugins/e2e.js +63 -62
- package/lib/ux/translate/vela/plugins/startPage.js +1 -1
- package/lib/ux/translate/vela/protobuf/BinaryPlugin.js +172 -172
- package/lib/ux/translate/vela/protobuf/protobuf.js +235 -235
- package/lib/ux/translate/vela/protobuf/protobufControl.js +159 -159
- package/lib/ux/translate/vela/protobuf/vdom_pb.js +2374 -2374
- package/lib/ux/translate/vela/runtime/velaTestLibrary.js +104 -104
- package/lib/ux/translate/vela/utils/AttributeConfig.js +15 -15
- package/lib/ux/translate/vela/utils/ExtendedBoxStyle.js +38 -38
- package/lib/ux/translate/vela/utils/SourceMapUtil.d.ts +0 -4
- package/lib/ux/translate/vela/utils/SourceMapUtil.js +30 -36
- package/lib/ux/translate/vela/utils/TemplateUtil.js +180 -180
- package/lib/ux/translate/vela/wrap/CbTranslate.js +8 -8
- package/lib/ux/translate/vela/wrap/CfTranslate.js +14 -14
- package/lib/ux/translate/vela/wrap/CiTranslate.js +11 -11
- package/lib/ux/utils/BabelUtil.js +35 -35
- package/lib/ux/utils/ElementConfigUtil.js +24 -24
- package/lib/ux/utils/StyleMapUtil.js +15 -15
- package/lib/ux/utils/StyleUtil.d.ts +1 -1
- package/lib/ux/utils/StyleUtil.js +192 -248
- package/lib/ux/utils/UxUtil.js +32 -32
- package/lib/ux/validate/ElementValidate.js +2 -2
- package/lib/ux/validate/UxFileValidate.js +2 -2
- package/package.json +4 -4
package/lib/ux/utils/UxUtil.js
CHANGED
|
@@ -6,15 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _path = _interopRequireDefault(require("path"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
/**
|
|
10
|
-
* UxParserUtil
|
|
9
|
+
/**
|
|
10
|
+
* UxParserUtil
|
|
11
11
|
*/
|
|
12
12
|
class UxUtil {
|
|
13
|
-
/**
|
|
14
|
-
* 重组文件名
|
|
15
|
-
* @param fileName
|
|
16
|
-
* @param extValue
|
|
17
|
-
* @returns
|
|
13
|
+
/**
|
|
14
|
+
* 重组文件名
|
|
15
|
+
* @param fileName
|
|
16
|
+
* @param extValue
|
|
17
|
+
* @returns
|
|
18
18
|
*/
|
|
19
19
|
static spliceFileName(fileName, extValue) {
|
|
20
20
|
const {
|
|
@@ -22,10 +22,10 @@ class UxUtil {
|
|
|
22
22
|
} = _path.default.parse(fileName);
|
|
23
23
|
return name && extValue ? `${name}.${extValue}` : '';
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
* 获取css的lang类型
|
|
27
|
-
* @param node
|
|
28
|
-
* @returns
|
|
25
|
+
/**
|
|
26
|
+
* 获取css的lang类型
|
|
27
|
+
* @param node
|
|
28
|
+
* @returns
|
|
29
29
|
*/
|
|
30
30
|
static getLangType(node) {
|
|
31
31
|
let langType = 'css';
|
|
@@ -37,27 +37,27 @@ class UxUtil {
|
|
|
37
37
|
}
|
|
38
38
|
return langType;
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
41
|
-
* 更新文件路径中的后缀
|
|
42
|
-
* @param path
|
|
43
|
-
* @param extValue
|
|
44
|
-
* @returns
|
|
40
|
+
/**
|
|
41
|
+
* 更新文件路径中的后缀
|
|
42
|
+
* @param path
|
|
43
|
+
* @param extValue
|
|
44
|
+
* @returns
|
|
45
45
|
*/
|
|
46
46
|
static updateFileName(path, extValue) {
|
|
47
47
|
const dirName = _path.default.dirname(path);
|
|
48
48
|
let newFileName = UxUtil.spliceFileName(path, extValue);
|
|
49
49
|
return newFileName ? _path.default.posix.join(dirName, newFileName) : path;
|
|
50
50
|
}
|
|
51
|
-
/**
|
|
52
|
-
* 将全局变量根据样式语言类型转为对应的变量声明
|
|
53
|
-
* {
|
|
54
|
-
* "a": "#fff"
|
|
55
|
-
* }
|
|
56
|
-
* 转为
|
|
57
|
-
* $a: #fff 或者 @a: #fff
|
|
58
|
-
* @param globalVar
|
|
59
|
-
* @param langType
|
|
60
|
-
* @returns
|
|
51
|
+
/**
|
|
52
|
+
* 将全局变量根据样式语言类型转为对应的变量声明
|
|
53
|
+
* {
|
|
54
|
+
* "a": "#fff"
|
|
55
|
+
* }
|
|
56
|
+
* 转为
|
|
57
|
+
* $a: #fff 或者 @a: #fff
|
|
58
|
+
* @param globalVar
|
|
59
|
+
* @param langType
|
|
60
|
+
* @returns
|
|
61
61
|
*/
|
|
62
62
|
static convertGlobalJson(globalVar) {
|
|
63
63
|
let langType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'css';
|
|
@@ -73,12 +73,12 @@ class UxUtil {
|
|
|
73
73
|
return varArray.join('\n');
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
/**
|
|
77
|
-
* 是否是绝对资源路径
|
|
78
|
-
*
|
|
79
|
-
* 1. 以/开头:/a/b/c.png
|
|
80
|
-
* 2. 以 ***://开头的视为绝对路径: package://a.png
|
|
81
|
-
* @param path
|
|
76
|
+
/**
|
|
77
|
+
* 是否是绝对资源路径
|
|
78
|
+
*
|
|
79
|
+
* 1. 以/开头:/a/b/c.png
|
|
80
|
+
* 2. 以 ***://开头的视为绝对路径: package://a.png
|
|
81
|
+
* @param path
|
|
82
82
|
*/
|
|
83
83
|
static isAbsoluteResource(path) {
|
|
84
84
|
if (!path) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiot-toolkit/parser",
|
|
3
|
-
"version": "2.0.5
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Parse the source code of aiot and convert it to the AST (Abstract Syntax Tree) of the target code.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aiot",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"test": "node ./__tests__/parser.test.js"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aiot-toolkit/shared-utils": "2.0.5
|
|
23
|
+
"@aiot-toolkit/shared-utils": "2.0.5",
|
|
24
24
|
"@babel/core": "^7.23.6",
|
|
25
25
|
"@babel/generator": "^7.24.10",
|
|
26
26
|
"@babel/parser": "^7.24.8",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"css-tree": "npm:aiot-css-tree@^2.3.1",
|
|
32
32
|
"csstree-validator": "^3.0.0",
|
|
33
33
|
"eslint": "^8.46.0",
|
|
34
|
-
"file-lane": "2.0.5
|
|
34
|
+
"file-lane": "2.0.5",
|
|
35
35
|
"fs-extra": "^11.2.0",
|
|
36
36
|
"google-protobuf": "^3.21.2",
|
|
37
37
|
"less": "^4.2.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"@types/tinycolor2": "^1.4.6",
|
|
61
61
|
"babel-plugin-tester": "^11.0.4"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "deb83e8b8fa65191a286690efe3d957d7df772f4"
|
|
64
64
|
}
|