@lcap/nasl 3.6.3-alpha.5 → 3.6.4-beta.1
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/out/concepts/CallFunction__.js +1 -1
- package/out/concepts/Logic__.d.ts +1 -1
- package/out/concepts/Logic__.js +2 -2
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +1 -1
- package/out/natural/genNaturalTS.js +22 -22
- package/out/natural/prompt/analyzeClaims.js +0 -2
- package/out/natural/prompt/analyzeClaims.js.map +1 -1
- package/out/natural/prompt/analyzeFormatOutput.js +0 -1
- package/out/natural/prompt/analyzeFormatOutput.js.map +1 -1
- package/out/natural/prompt/analyzeTasks.js +9 -13
- package/out/natural/prompt/analyzeTasks.js.map +1 -1
- package/out/natural/prompt/executeClaims.js +4 -4
- package/out/natural/transformTSCode.js +8 -1
- package/out/natural/transformTSCode.js.map +1 -1
- package/out/translator/types.d.ts +13 -2
- package/out/translator/utils.js +2 -2
- package/out/translator/utils.js.map +1 -1
- package/package.json +1 -1
- package/sandbox-natural/stdlib/nasl.util.ts +0 -2
- package/src/concepts/CallFunction__.ts +1 -1
- package/src/concepts/Logic__.ts +2 -2
- package/src/concepts/TypeAnnotation__.ts +1 -1
- package/src/natural/genNaturalTS.ts +22 -22
- package/src/natural/prompt/analyzeClaims.ts +0 -2
- package/src/natural/prompt/analyzeFormatOutput.ts +0 -1
- package/src/natural/prompt/analyzeTasks.ts +9 -13
- package/src/natural/prompt/executeClaims.ts +4 -4
- package/src/natural/transformTSCode.ts +7 -1
- package/src/translator/types.ts +20 -9
- package/src/translator/utils.ts +2 -2
package/src/translator/types.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { BaseNode } from '../concepts';
|
|
2
2
|
|
|
3
3
|
export interface PositionWithoutOffset {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
line: number;
|
|
5
|
+
character: number;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export interface Position extends PositionWithoutOffset {
|
|
9
|
-
|
|
9
|
+
offset: number;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export interface Range {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
start: Position;
|
|
14
|
+
end: Position;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface RangeOffsetOnly {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
start: number;
|
|
19
|
+
end: number;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export interface TSPPosition {
|
|
@@ -46,9 +46,20 @@ export interface TranslatorState {
|
|
|
46
46
|
preferQuote?: 'single' | 'double' | 'backtick';
|
|
47
47
|
sourceMap?: SourceMap;
|
|
48
48
|
finalCode?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* 当前用户聚焦的位置
|
|
51
|
+
* 目前会自动标记一个`/* 当前位置 *\/`的注释信息
|
|
52
|
+
* @example 逻辑生成
|
|
53
|
+
*/
|
|
49
54
|
focusedNodePath?: string;
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
needNamespace?: boolean; // toNaturalTS 使用,是否需要带 typeNamespace
|
|
56
|
+
/**
|
|
57
|
+
* 生成时带上`// nodePath`注释信息
|
|
58
|
+
* 目前只会在语句前带注释
|
|
59
|
+
* @example 逻辑解读
|
|
60
|
+
* @example 修改逻辑节点
|
|
61
|
+
*/
|
|
62
|
+
nodePathComment?: boolean;
|
|
52
63
|
getVuePrototype?: boolean;
|
|
53
64
|
|
|
54
65
|
noNeedParams?: boolean;
|
package/src/translator/utils.ts
CHANGED
|
@@ -131,8 +131,8 @@ export function withSourceMap() {
|
|
|
131
131
|
end: shiftPosition(state.position, code),
|
|
132
132
|
});
|
|
133
133
|
|
|
134
|
-
if (isNatural && statementMap?.includes(this.concept) && code
|
|
135
|
-
before += `// nodePath: '${this.nodePath}' \n`;
|
|
134
|
+
if (isNatural && state.nodePathComment && statementMap?.includes(this.concept) && code) {
|
|
135
|
+
before += `// nodePath: '${this.nodePath}' \n${indent((state?.tabSize || 0))}`;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
return before + code;
|