@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.
@@ -1,22 +1,22 @@
1
1
  import type { BaseNode } from '../concepts';
2
2
 
3
3
  export interface PositionWithoutOffset {
4
- line: number;
5
- character: number;
4
+ line: number;
5
+ character: number;
6
6
  }
7
7
 
8
8
  export interface Position extends PositionWithoutOffset {
9
- offset: number;
9
+ offset: number;
10
10
  }
11
11
 
12
12
  export interface Range {
13
- start: Position;
14
- end: Position;
13
+ start: Position;
14
+ end: Position;
15
15
  }
16
16
 
17
17
  export interface RangeOffsetOnly {
18
- start: number;
19
- end: number;
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
- convertType?: string; // toNaturalTS 使用,是否需要带 nodePath
51
- needNameSpace?: boolean; // toNaturalTS 使用,是否需要带 typeNamespace
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;
@@ -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 && state?.convertType) {
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;