@vtj/parser 0.16.30 → 0.16.32
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/dist/index.cjs +15 -15
- package/dist/index.mjs +1069 -1052
- package/package.json +3 -3
- package/types/version.d.ts +2 -2
- package/types/vue/utils.d.ts +13 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtj/parser",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.16.
|
|
4
|
+
"version": "0.16.32",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"低代码引擎",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"postcss": "~8.5.0",
|
|
32
32
|
"sass": "~1.97.1",
|
|
33
33
|
"@vtj/base": "~0.12.4",
|
|
34
|
-
"@vtj/
|
|
35
|
-
"@vtj/
|
|
34
|
+
"@vtj/core": "~0.16.32",
|
|
35
|
+
"@vtj/coder": "~0.16.32"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@vtj/cli": "~0.12.19"
|
package/types/version.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/parser
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.16.
|
|
5
|
+
* @version 0.16.31
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
7
|
*/
|
|
8
|
-
export declare const version = "0.16.
|
|
8
|
+
export declare const version = "0.16.31";
|
package/types/vue/utils.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { JSExpression, JSFunction, PlatformType, DataSourceSchema } from '@vtj/core';
|
|
2
|
+
import { replacer } from './replacer';
|
|
3
|
+
export { replacer };
|
|
2
4
|
export interface ExpressionOptions {
|
|
3
5
|
platform: PlatformType;
|
|
4
6
|
context: Record<string, Set<string>>;
|
|
@@ -7,6 +9,17 @@ export interface ExpressionOptions {
|
|
|
7
9
|
members: string[];
|
|
8
10
|
props: string[];
|
|
9
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* 检查标识符是否在函数参数位置
|
|
14
|
+
* 包括:function(key)、 (key) =>、 key =>、 (a, key, b) => 等
|
|
15
|
+
* 不包括:函数调用参数如 obj.method(key) 中的 key
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* 判断当前位置是否处于 ES6 对象字面量简写属性位置
|
|
19
|
+
* 例如 { key } 或 { a, key } 中的 key
|
|
20
|
+
* 特点:key 前面是 { 或 ,,后面紧跟 , 或 }
|
|
21
|
+
* 如果后面紧跟 : 则为普通属性名,不算简写
|
|
22
|
+
*/
|
|
10
23
|
/**
|
|
11
24
|
* 简化的字符串替换函数,遵循以下规则:
|
|
12
25
|
* 1. 字符串中的 key 不替换(包括模板字符串普通文本,但 ${key} 中的 key 要替换)
|
|
@@ -16,7 +29,6 @@ export interface ExpressionOptions {
|
|
|
16
29
|
* 5. 前后有单词字符(a-zA-Z0-9_$@-)不替换
|
|
17
30
|
* 6. 其他情况替换:赋值、函数调用、数组元素、模板表达式等
|
|
18
31
|
*/
|
|
19
|
-
export declare function replacer(content: string, key: string, to: string): string;
|
|
20
32
|
export declare function patchCode(content: string, id: string, options: ExpressionOptions): string;
|
|
21
33
|
export declare function getJSExpression(content: string): JSExpression;
|
|
22
34
|
export declare function getJSFunction(content: string): JSFunction;
|