@lcap/nasl 4.4.0-beta.9 → 4.4.0-rc.2

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 (204) hide show
  1. package/out/generator/genBundleFiles.d.ts.map +1 -1
  2. package/out/generator/genBundleFiles.js +32 -3
  3. package/out/generator/genBundleFiles.js.map +1 -1
  4. package/out/generator/qiankun.d.ts +1 -1
  5. package/out/generator/qiankun.d.ts.map +1 -1
  6. package/out/generator/qiankun.js +4 -0
  7. package/out/generator/qiankun.js.map +1 -1
  8. package/out/generator/release-body/body.d.ts +0 -1
  9. package/out/generator/release-body/body.d.ts.map +1 -1
  10. package/out/generator/release-body/body.js +1 -390
  11. package/out/generator/release-body/body.js.map +1 -1
  12. package/out/generator/release-body/data.d.ts.map +1 -1
  13. package/out/generator/release-body/data.js +1 -10
  14. package/out/generator/release-body/data.js.map +1 -1
  15. package/out/generator/release-body/share-content.js.map +1 -1
  16. package/out/generator/release-body/types.d.ts +1 -0
  17. package/out/generator/release-body/types.d.ts.map +1 -1
  18. package/out/generator/templates/chunk.js +1 -1
  19. package/out/generator/templates/runtime.js +2 -2
  20. package/out/natural/exports/nasl2Files.d.ts.map +1 -0
  21. package/out/natural/{getContext → exports}/nasl2Files.js +4 -4
  22. package/out/natural/exports/nasl2Files.js.map +1 -0
  23. package/out/natural/{transform2BatchActions.d.ts → exports/transform2BatchActions.d.ts} +1 -1
  24. package/out/natural/exports/transform2BatchActions.d.ts.map +1 -0
  25. package/out/natural/{transform2BatchActions.js → exports/transform2BatchActions.js} +68 -19
  26. package/out/natural/exports/transform2BatchActions.js.map +1 -0
  27. package/out/natural/index.d.ts +12 -12
  28. package/out/natural/index.d.ts.map +1 -1
  29. package/out/natural/index.js +12 -14
  30. package/out/natural/index.js.map +1 -1
  31. package/out/natural/{genNaturalTS.d.ts → old/getContext/genNaturalTS.d.ts} +12 -12
  32. package/out/natural/old/getContext/genNaturalTS.d.ts.map +1 -0
  33. package/out/natural/{genNaturalTS.js → old/getContext/genNaturalTS.js} +65 -65
  34. package/out/natural/old/getContext/genNaturalTS.js.map +1 -0
  35. package/out/natural/old/getContext/genTextualNASL.d.ts.map +1 -0
  36. package/out/natural/old/getContext/genTextualNASL.js.map +1 -0
  37. package/out/natural/{getContext → old/getContext}/getUILib.d.ts +1 -1
  38. package/out/natural/old/getContext/getUILib.d.ts.map +1 -0
  39. package/out/natural/{getContext → old/getContext}/getUILib.js +14 -14
  40. package/out/natural/old/getContext/getUILib.js.map +1 -0
  41. package/out/natural/{getContext → old/getContext}/index.d.ts +3 -3
  42. package/out/natural/old/getContext/index.d.ts.map +1 -0
  43. package/out/natural/{getContext → old/getContext}/index.js +4 -4
  44. package/out/natural/old/getContext/index.js.map +1 -0
  45. package/out/natural/old/getContext/naslStdlibMap.d.ts.map +1 -0
  46. package/out/natural/{getContext → old/getContext}/naslStdlibMap.js +10 -10
  47. package/out/natural/old/getContext/naslStdlibMap.js.map +1 -0
  48. package/out/natural/{transformTS2UI.d.ts → old/parser/transformTS2UI.d.ts} +2 -2
  49. package/out/natural/old/parser/transformTS2UI.d.ts.map +1 -0
  50. package/out/natural/{transformTS2UI.js → old/parser/transformTS2UI.js} +12 -13
  51. package/out/natural/old/parser/transformTS2UI.js.map +1 -0
  52. package/out/natural/{transformTSCode.d.ts → old/parser/transformTSCode.d.ts} +1 -1
  53. package/out/natural/old/parser/transformTSCode.d.ts.map +1 -0
  54. package/out/natural/{transformTSCode.js → old/parser/transformTSCode.js} +6 -6
  55. package/out/natural/old/parser/transformTSCode.js.map +1 -0
  56. package/out/natural/{tools.d.ts → old/tools.d.ts} +0 -4
  57. package/out/natural/old/tools.d.ts.map +1 -0
  58. package/out/natural/{tools.js → old/tools.js} +7 -25
  59. package/out/natural/old/tools.js.map +1 -0
  60. package/out/natural/{parseNaturalTS.d.ts → parser/parseNaturalTS.d.ts} +1 -1
  61. package/out/natural/parser/parseNaturalTS.d.ts.map +1 -0
  62. package/out/natural/{parseNaturalTS.js → parser/parseNaturalTS.js} +14 -10
  63. package/out/natural/parser/parseNaturalTS.js.map +1 -0
  64. package/out/natural/{parseNaturalTSXView.d.ts → parser/parseNaturalTSXView.d.ts} +1 -2
  65. package/out/natural/parser/parseNaturalTSXView.d.ts.map +1 -0
  66. package/out/natural/{parseNaturalTSXView.js → parser/parseNaturalTSXView.js} +51 -58
  67. package/out/natural/parser/parseNaturalTSXView.js.map +1 -0
  68. package/out/natural/transforms/checker/checkDataQueryCalleeNameOrder.d.ts +7 -0
  69. package/out/natural/transforms/checker/checkDataQueryCalleeNameOrder.d.ts.map +1 -0
  70. package/out/natural/transforms/checker/checkDataQueryCalleeNameOrder.js +38 -0
  71. package/out/natural/transforms/checker/checkDataQueryCalleeNameOrder.js.map +1 -0
  72. package/out/natural/transforms/checker/checkDefaultValue.d.ts +13 -0
  73. package/out/natural/transforms/checker/checkDefaultValue.d.ts.map +1 -0
  74. package/out/natural/transforms/checker/checkDefaultValue.js +33 -0
  75. package/out/natural/transforms/checker/checkDefaultValue.js.map +1 -0
  76. package/out/natural/transforms/checker/checkViewElement.d.ts +29 -0
  77. package/out/natural/transforms/checker/checkViewElement.d.ts.map +1 -0
  78. package/out/natural/transforms/checker/checkViewElement.js +422 -0
  79. package/out/natural/transforms/checker/checkViewElement.js.map +1 -0
  80. package/out/natural/transforms/checker/index.d.ts +17 -0
  81. package/out/natural/transforms/checker/index.d.ts.map +1 -0
  82. package/out/natural/transforms/checker/index.js +26 -0
  83. package/out/natural/transforms/checker/index.js.map +1 -0
  84. package/out/natural/transforms/transform2Entity.d.ts +8 -1
  85. package/out/natural/transforms/transform2Entity.d.ts.map +1 -1
  86. package/out/natural/transforms/transform2Entity.js +88 -18
  87. package/out/natural/transforms/transform2Entity.js.map +1 -1
  88. package/out/natural/transforms/transform2Enum.d.ts +1 -1
  89. package/out/natural/transforms/transform2Enum.d.ts.map +1 -1
  90. package/out/natural/transforms/transform2Enum.js +5 -1
  91. package/out/natural/transforms/transform2Enum.js.map +1 -1
  92. package/out/natural/transforms/transform2GlobalLogicDeclaration.d.ts +1 -1
  93. package/out/natural/transforms/transform2GlobalLogicDeclaration.d.ts.map +1 -1
  94. package/out/natural/transforms/transform2GlobalLogicDeclaration.js +3 -3
  95. package/out/natural/transforms/transform2GlobalLogicDeclaration.js.map +1 -1
  96. package/out/natural/transforms/transform2Logic.d.ts +1 -1
  97. package/out/natural/transforms/transform2Logic.d.ts.map +1 -1
  98. package/out/natural/transforms/transform2Logic.js +4 -4
  99. package/out/natural/transforms/transform2Logic.js.map +1 -1
  100. package/out/natural/transforms/transform2LogicItem.d.ts +6 -3
  101. package/out/natural/transforms/transform2LogicItem.d.ts.map +1 -1
  102. package/out/natural/transforms/transform2LogicItem.js +99 -110
  103. package/out/natural/transforms/transform2LogicItem.js.map +1 -1
  104. package/out/natural/transforms/transform2MetadataType.d.ts +1 -1
  105. package/out/natural/transforms/transform2MetadataType.d.ts.map +1 -1
  106. package/out/natural/transforms/transform2MetadataType.js +1 -1
  107. package/out/natural/transforms/transform2MetadataType.js.map +1 -1
  108. package/out/natural/transforms/transform2Param.d.ts +4 -0
  109. package/out/natural/transforms/transform2Param.d.ts.map +1 -0
  110. package/out/natural/transforms/transform2Param.js +114 -0
  111. package/out/natural/transforms/transform2Param.js.map +1 -0
  112. package/out/natural/transforms/transform2Structure.d.ts +1 -1
  113. package/out/natural/transforms/transform2Structure.d.ts.map +1 -1
  114. package/out/natural/transforms/transform2Structure.js +13 -2
  115. package/out/natural/transforms/transform2Structure.js.map +1 -1
  116. package/out/natural/transforms/transform2TypeAnnotation.d.ts +1 -1
  117. package/out/natural/transforms/transform2TypeAnnotation.d.ts.map +1 -1
  118. package/out/natural/transforms/transform2TypeAnnotation.js +2 -2
  119. package/out/natural/transforms/transform2TypeAnnotation.js.map +1 -1
  120. package/out/natural/transforms/transform2ValidationRule.d.ts +1 -1
  121. package/out/natural/transforms/transform2ValidationRule.d.ts.map +1 -1
  122. package/out/natural/transforms/transform2ValidationRule.js +1 -1
  123. package/out/natural/transforms/transform2ValidationRule.js.map +1 -1
  124. package/out/natural/transforms/transform2Variable.d.ts +2 -1
  125. package/out/natural/transforms/transform2Variable.d.ts.map +1 -1
  126. package/out/natural/transforms/transform2Variable.js +22 -2
  127. package/out/natural/transforms/transform2Variable.js.map +1 -1
  128. package/out/natural/transforms/transformThemeAndStyle.d.ts +1 -1
  129. package/out/natural/transforms/transformThemeAndStyle.d.ts.map +1 -1
  130. package/out/natural/transforms/transformThemeAndStyle.js +1 -1
  131. package/out/natural/transforms/transformThemeAndStyle.js.map +1 -1
  132. package/out/natural/transforms/utils/fetchFromComments.d.ts +3 -0
  133. package/out/natural/transforms/utils/fetchFromComments.d.ts.map +1 -0
  134. package/out/natural/transforms/utils/fetchFromComments.js +10 -0
  135. package/out/natural/transforms/utils/fetchFromComments.js.map +1 -0
  136. package/out/natural/transforms/utils/misc.d.ts +16 -0
  137. package/out/natural/transforms/utils/misc.d.ts.map +1 -0
  138. package/out/natural/transforms/utils/misc.js +240 -0
  139. package/out/natural/transforms/utils/misc.js.map +1 -0
  140. package/out/natural/transforms/utils/parseDecorator.d.ts +46 -0
  141. package/out/natural/transforms/utils/parseDecorator.d.ts.map +1 -0
  142. package/out/natural/transforms/utils/parseDecorator.js +180 -0
  143. package/out/natural/transforms/utils/parseDecorator.js.map +1 -0
  144. package/out/natural/utils/index.d.ts +59 -0
  145. package/out/natural/utils/index.d.ts.map +1 -0
  146. package/out/natural/utils/index.js +168 -0
  147. package/out/natural/utils/index.js.map +1 -0
  148. package/out/server/extendBaseNode.js +14 -0
  149. package/out/server/extendBaseNode.js.map +1 -1
  150. package/out/server/findReference.js +1 -1
  151. package/out/server/findReference.js.map +1 -1
  152. package/out/server/naslServer.d.ts.map +1 -1
  153. package/out/server/naslServer.js +33 -17
  154. package/out/server/naslServer.js.map +1 -1
  155. package/out/server/translator.js.map +1 -1
  156. package/out/service/autofix/rules/rule-convert-incompatible-assignment-to-union.js.map +1 -1
  157. package/out/service/storage/init.d.ts.map +1 -1
  158. package/out/service/storage/init.js +9 -2
  159. package/out/service/storage/init.js.map +1 -1
  160. package/out/templator/block2nasl/transformBlock2Nasl.js +2 -2
  161. package/out/templator/block2nasl/transformBlock2Nasl.js.map +1 -1
  162. package/out/utils/can-i-use.d.ts.map +1 -1
  163. package/out/utils/can-i-use.js +1 -0
  164. package/out/utils/can-i-use.js.map +1 -1
  165. package/package.json +9 -9
  166. package/sandbox/stdlib/nasl.core.ts +2 -0
  167. package/sandbox/stdlib/nasl.io.ts +1 -1
  168. package/sandbox/stdlib/nasl.oql.ts +2 -0
  169. package/out/natural/genNaturalTS.d.ts.map +0 -1
  170. package/out/natural/genNaturalTS.js.map +0 -1
  171. package/out/natural/genTextualNASL.d.ts.map +0 -1
  172. package/out/natural/genTextualNASL.js.map +0 -1
  173. package/out/natural/getContext/getUILib.d.ts.map +0 -1
  174. package/out/natural/getContext/getUILib.js.map +0 -1
  175. package/out/natural/getContext/index.d.ts.map +0 -1
  176. package/out/natural/getContext/index.js.map +0 -1
  177. package/out/natural/getContext/nasl2Files.d.ts.map +0 -1
  178. package/out/natural/getContext/nasl2Files.js.map +0 -1
  179. package/out/natural/getContext/naslStdlibMap.d.ts.map +0 -1
  180. package/out/natural/getContext/naslStdlibMap.js.map +0 -1
  181. package/out/natural/parseNaturalTS.d.ts.map +0 -1
  182. package/out/natural/parseNaturalTS.js.map +0 -1
  183. package/out/natural/parseNaturalTSXView.d.ts.map +0 -1
  184. package/out/natural/parseNaturalTSXView.js.map +0 -1
  185. package/out/natural/tools.d.ts.map +0 -1
  186. package/out/natural/tools.js.map +0 -1
  187. package/out/natural/transform2BatchActions.d.ts.map +0 -1
  188. package/out/natural/transform2BatchActions.js.map +0 -1
  189. package/out/natural/transformTS2UI.d.ts.map +0 -1
  190. package/out/natural/transformTS2UI.js.map +0 -1
  191. package/out/natural/transformTSCode.d.ts.map +0 -1
  192. package/out/natural/transformTSCode.js.map +0 -1
  193. package/out/natural/transforms/checkViewElement.d.ts +0 -12
  194. package/out/natural/transforms/checkViewElement.d.ts.map +0 -1
  195. package/out/natural/transforms/checkViewElement.js +0 -143
  196. package/out/natural/transforms/checkViewElement.js.map +0 -1
  197. package/out/natural/transforms/utils.d.ts +0 -137
  198. package/out/natural/transforms/utils.d.ts.map +0 -1
  199. package/out/natural/transforms/utils.js +0 -714
  200. package/out/natural/transforms/utils.js.map +0 -1
  201. /package/out/natural/{getContext → exports}/nasl2Files.d.ts +0 -0
  202. /package/out/natural/{genTextualNASL.d.ts → old/getContext/genTextualNASL.d.ts} +0 -0
  203. /package/out/natural/{genTextualNASL.js → old/getContext/genTextualNASL.js} +0 -0
  204. /package/out/natural/{getContext → old/getContext}/naslStdlibMap.d.ts +0 -0
@@ -1,143 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkViewElement = void 0;
4
- const utils_1 = require("./utils");
5
- /**
6
- * 检查 el-table 组件
7
- */
8
- function checkElTable({ viewElement, node, options }) {
9
- (0, utils_1.addLint)(options, {
10
- name: '表格列不推荐全设置宽度',
11
- description: '从表格列中选取几个较长文本字段(如名称、地址、描述等)不设置宽度,以便自适应显示,其他列可根据展示内容和表格整体宽度酌情设置宽度。 使用style属性进行宽度设置。',
12
- }, (rule) => {
13
- // 检查所有子元素是否都是 el-table-column 且都有 width 样式
14
- const allColumnsHaveWidth = viewElement.children.every((child) => {
15
- return (child.tag === 'el-table-column' &&
16
- child.staticStyle &&
17
- child.staticStyle.includes('width:'));
18
- });
19
- if (allColumnsHaveWidth) {
20
- return (0, utils_1.throwError)(options, `${rule.name}: ${rule.description}`, node);
21
- }
22
- });
23
- }
24
- /**
25
- * 检查 el-form 组件
26
- */
27
- function checkElForm({ viewElement, node, options }) {
28
- (0, utils_1.addLint)(options, {
29
- name: '表单缺少校验',
30
- description: '表单定义中包含校验规则,需要为 ElForm 设置 ref 属性,并在提交前调用 validated() 方法进行校验',
31
- }, (rule) => {
32
- // 递归检查所有子孙元素中以 el-form 开头的组件是否有 rules
33
- function hasRulesInFormItems(element) {
34
- // 检查当前元素(以 el-form 开头但不是 el-form 本身)
35
- if (element.tag.startsWith('el-form') && element.tag !== 'el-form') {
36
- if (element.bindAttrs.some((bindAttr) => bindAttr.name === 'rules')) {
37
- return true;
38
- }
39
- }
40
- // 递归检查子元素,但跳过嵌套的 el-form(它们会有自己的校验)
41
- for (const child of element.children) {
42
- if (child.tag === 'el-form') {
43
- // 跳过嵌套的 el-form,因为它会有自己的检查
44
- continue;
45
- }
46
- if (hasRulesInFormItems(child)) {
47
- return true;
48
- }
49
- }
50
- return false;
51
- }
52
- const hasRule = hasRulesInFormItems(viewElement);
53
- const hasRef = viewElement.name;
54
- if (hasRule && !hasRef) {
55
- return (0, utils_1.throwError)(options, `${rule.name}: ${rule.description}`, node);
56
- }
57
- });
58
- }
59
- /**
60
- * 检查 el-date-picker 组件
61
- */
62
- function checkElDatePicker({ viewElement, node, options }) {
63
- // 1. 禁止使用 valueFormat 属性
64
- const valueFormatAttr = viewElement.bindAttrs.find((attr) => attr.name === 'valueFormat');
65
- if (valueFormatAttr) {
66
- (0, utils_1.throwError)(options, '日期选择器不允许设置 valueFormat 属性', node);
67
- }
68
- // 获取 type 属性值
69
- const typeAttr = viewElement.bindAttrs.find((attr) => attr.name === 'type');
70
- let typeValue;
71
- if (typeAttr) {
72
- if (typeAttr.type === 'static' || typeAttr.type === 'string') {
73
- typeValue = typeof typeAttr.value === 'string' ? typeAttr.value : String(typeAttr.value);
74
- // 2. 禁止使用的 type 值
75
- const forbiddenTypes = ['dates', 'years', 'months'];
76
- if (forbiddenTypes.includes(typeValue)) {
77
- (0, utils_1.throwError)(options, `日期选择器 type 属性不允许设置值: ${typeValue}`, node);
78
- }
79
- }
80
- }
81
- // 3. 检查双向绑定规则
82
- const rangeTypes = ['daterange', 'datetimerange', 'yearrange', 'monthrange'];
83
- const singleTypes = ['date', 'datetime', 'year', 'month', 'week'];
84
- const startValueAttr = viewElement.bindAttrs.find((attr) => attr.name === 'startValue');
85
- const endValueAttr = viewElement.bindAttrs.find((attr) => attr.name === 'endValue');
86
- const modelValueAttr = viewElement.bindAttrs.find((attr) => attr.name === 'modelValue');
87
- const hasStartValue = startValueAttr && startValueAttr.sync;
88
- const hasEndValue = endValueAttr && endValueAttr.sync;
89
- const hasModelValue = modelValueAttr && modelValueAttr.sync;
90
- if (typeValue) {
91
- if (rangeTypes.includes(typeValue)) {
92
- // 范围类型只能使用 startValue 和 endValue
93
- if (hasModelValue) {
94
- (0, utils_1.throwError)(options, `当 type 属性值为 '${typeValue}' 时,不能用 modelValue,只能用 startValue 和 endValue`, node);
95
- }
96
- }
97
- else if (singleTypes.includes(typeValue)) {
98
- // 单个类型只能使用 modelValue
99
- if (hasStartValue || hasEndValue) {
100
- (0, utils_1.throwError)(options, `当 type 属性值为 '${typeValue}' 时,不能用 startValue 和 endValue,只能用 modelValue`, node);
101
- }
102
- }
103
- }
104
- // 4. 添加 range 属性
105
- const singleTypesForRange = ['datetime', 'date', 'year', 'month', 'week'];
106
- // 检查是否已存在 range 属性
107
- const existingRangeAttr = viewElement.bindAttrs.find((attr) => attr.name === 'range');
108
- if (!existingRangeAttr) {
109
- let rangeValue = true;
110
- if (typeValue && singleTypesForRange.includes(typeValue)) {
111
- rangeValue = false;
112
- }
113
- const rangeAttr = new utils_1.naslTypes.BindAttribute({
114
- name: 'range',
115
- type: 'static',
116
- value: rangeValue,
117
- });
118
- viewElement.addBindAttribute(rangeAttr);
119
- }
120
- }
121
- /**
122
- * 对 ViewElement 进行校验
123
- * 根据组件标签调用相应的校验函数
124
- */
125
- function checkViewElement(params) {
126
- const { viewElement } = params;
127
- const { tag } = viewElement;
128
- switch (tag) {
129
- case 'el-table':
130
- checkElTable(params);
131
- break;
132
- case 'el-form':
133
- checkElForm(params);
134
- break;
135
- case 'el-date-picker':
136
- checkElDatePicker(params);
137
- break;
138
- default:
139
- break;
140
- }
141
- }
142
- exports.checkViewElement = checkViewElement;
143
- //# sourceMappingURL=checkViewElement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkViewElement.js","sourceRoot":"","sources":["../../../src/natural/transforms/checkViewElement.ts"],"names":[],"mappings":";;;AAAA,mCAAqF;AAQrF;;GAEG;AACH,SAAS,YAAY,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAA0B;IAC1E,IAAA,eAAO,EACL,OAAO,EACP;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EACT,oFAAoF;KACvF,EACD,CAAC,IAAI,EAAE,EAAE;QACP,2CAA2C;QAC3C,MAAM,mBAAmB,GAAG,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YAC/D,OAAO,CACL,KAAK,CAAC,GAAG,KAAK,iBAAiB;gBAC/B,KAAK,CAAC,WAAW;gBACjB,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACrC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,IAAI,mBAAmB,EAAE,CAAC;YACxB,OAAO,IAAA,kBAAU,EAAC,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,CAAC;QACxE,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAA0B;IACzE,IAAA,eAAO,EACL,OAAO,EACP;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EACT,6DAA6D;KAChE,EACD,CAAC,IAAI,EAAE,EAAE;QACP,sCAAsC;QACtC,SAAS,mBAAmB,CAAC,OAA8B;YACzD,qCAAqC;YACrC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;gBACnE,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,Q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AAC;IAC1C,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,MAA8B;IAC7D,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IAC/B,MAAM,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC;IAE5B,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,UAAU;YACb,YAAY,CAAC,MAAM,CAAC,CAAC;YACrB,MAAM;QACR,KAAK,SAAS;YACZ,WAAW,CAAC,MAAM,CAAC,CAAC;YACpB,MAAM;QACR,KAAK,gBAAgB;YACnB,iBAAiB,CAAC,MAAM,CAAC,CAAC;YAC1B,MAAM;QACR;YACE,MAAM;IACV,CAAC;AACH,CAAC;AAjBD,4CAiBC"}
@@ -1,137 +0,0 @@
1
- import * as babel from '@babel/core';
2
- import * as babelTypes from '@babel/types';
3
- import * as naslTypes from '../../concepts';
4
- import generate from '@babel/generator';
5
- export { babelTypes, naslTypes, generate };
6
- export declare function DEBUG(): boolean;
7
- export declare const parseNaturalTSErrorMap: Record<number, Array<string>>;
8
- export declare class ParseNaturalTSError extends Error {
9
- constructor(message: string);
10
- }
11
- export interface ParseNaturalTSState {
12
- $$beacon: true;
13
- parsingId?: number;
14
- nodeNamespace?: string;
15
- nodeName?: string;
16
- moduleName?: string;
17
- appendExtName?: boolean;
18
- source?: string;
19
- componentsMap?: componentsMap;
20
- strictForTraining?: boolean;
21
- }
22
- export interface ParseLogicState extends ParseNaturalTSState {
23
- isInFrontend?: boolean;
24
- logicType?: 'global_logic' | 'view_logic' | 'event_logic';
25
- logicKind?: 'declare' | 'export';
26
- }
27
- export interface ParseViewState extends ParseLogicState {
28
- nameMap: Map<string, boolean>;
29
- parentTag?: string;
30
- }
31
- /**
32
- * 抛出错误
33
- * @param message 错误信息
34
- * @param babelNode babel节点,用于便捷生成代码片段信息
35
- * @param babelNode2 babel节点,用于便捷生成代码片段信息
36
- */
37
- export declare function throwError(state: ParseNaturalTSState, message: string, babelNode?: babelTypes.Node | string, babelNode2?: babelTypes.Node | string): undefined;
38
- /**
39
- * 抛出警告,在 DEBUG 模式下不抛出这类错误
40
- * @param message 错误信息
41
- * @param babelNode babel节点,用于便捷生成代码片段信息
42
- * @param babelNode2 babel节点,用于便捷生成代码片段信息
43
- */
44
- export declare function throwWarning(message: string, babelNode?: babelTypes.Node | string, babelNode2?: babelTypes.Node | string): void;
45
- export declare function tryParseTS(tsCode: string): import("@babel/parser").ParseResult<babel.types.File>;
46
- export declare const callFunctionMap: string[];
47
- export declare const replaceCallFunctionMap: {
48
- ListAdd: string;
49
- ListAddAll: string;
50
- ListContains: string;
51
- ListInsert: string;
52
- ListGet: string;
53
- ListRemove: string;
54
- ListRemoveAt: string;
55
- ListSet: string;
56
- COUNTD: string;
57
- };
58
- export declare function upgradeListSort(node: any): any;
59
- export declare function handleListSort(node: naslTypes.CallFunction, parseState: ParseNaturalTSState): naslTypes.CallFunction | void;
60
- export declare function fetchFromComments(comments?: Array<babelTypes.Comment | babelTypes.CommentBlock>): string;
61
- export declare function checkOQLCalleeNameOrder(calleeNames: Array<string>): boolean;
62
- export declare function pickDecoratorObject(objectExpression: babelTypes.ObjectExpression, keys: Set<string>, parseState: ParseNaturalTSState): Record<string, any>;
63
- type componentsMap = Map<string, {
64
- component: any;
65
- propsMap: Map<string, any>;
66
- eventsMap: Map<string, any>;
67
- slotsMap: Map<string, any>;
68
- }>;
69
- /**
70
- * 检查组件是否有指定的prop配置
71
- * @param tagName 组件标签名
72
- * @param propName 属性名
73
- * @param lookupMap 查找Map
74
- * @returns 返回 true 或 false
75
- */
76
- export declare function getComponentProp(tagName: string, propName: string, lookupMap: componentsMap): boolean;
77
- /**
78
- * 检查组件是否有指定的事件配置
79
- * @param tagName 组件标签名
80
- * @param eventName 事件名
81
- * @param lookupMap 查找Map
82
- * @returns 返回 true 或 false
83
- */
84
- export declare function getComponentEvent(tagName: string, eventName: string, lookupMap: componentsMap): boolean;
85
- /**
86
- * 检查组件是否有指定的slot配置
87
- * @param tagName 组件标签名
88
- * @param slotName 插槽名
89
- * @param lookupMap 查找Map
90
- * @returns 返回 true 或 false
91
- */
92
- export declare function getComponentSlot(tagName: string, slotName: string, lookupMap: componentsMap): boolean;
93
- /**
94
- * 获取组件的完整配置信息
95
- * @param tagName 组件标签名
96
- * @param type 查找类型
97
- * @param lookupMap 查找Map
98
- * @returns 返回组件配置或null
99
- */
100
- export declare function getComponentInfo(tagName: string, lookupMap: componentsMap, type?: 'prop' | 'event' | 'slot'): any;
101
- /**
102
- * 组件特性校验函数
103
- * @param tag 组件标签名
104
- * @param featureType 特性类型
105
- * @param featureName 特性名称
106
- * @param attrName 属性名
107
- * @param options 解析状态选项
108
- * @param attr JSX属性节点
109
- */
110
- export declare function validateComponentFeature(tag: string, featureType: 'event' | 'slot' | 'prop', featureName: string, options: ParseViewState, attr: babelTypes.JSXAttribute): void;
111
- /**
112
- * 解析 parentAccept 表达式,生成友好的错误描述
113
- * @param parentAccept parentAccept 表达式字符串
114
- * @returns 友好的错误描述字符串
115
- */
116
- export declare function parseParentAcceptDescription(parentAccept: string): string;
117
- /**
118
- * 验证父组件约束
119
- * @param tag 当前组件标签
120
- * @param options 解析状态选项
121
- * @param node JSX节点
122
- * @returns 如果违反约束则返回错误,否则返回 undefined
123
- */
124
- export declare function validateParentConstraints(tag: string, options: ParseViewState, node: babelTypes.JSXElement): void | undefined;
125
- export interface LintRule {
126
- name: string;
127
- description?: string;
128
- }
129
- /**
130
- * 在 strictForTraining 模式下执行 lint 检查逻辑
131
- * 当 options.strictForTraining 为 true 时,执行传入的检查函数
132
- * @param rule LintRule 对象,包含 name 和可选的 description
133
- * @param options 解析状态选项
134
- * @param lintFn 需要执行的 lint 检查函数
135
- */
136
- export declare function addLint<T extends ParseNaturalTSState>(options: T, rule: LintRule, lintFn: (rule: LintRule) => void): void;
137
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/natural/transfor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