@lcap/nasl-language-server-core 4.3.0-beta.0 → 4.3.0-beta.3

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 (107) hide show
  1. package/out/checker.d.ts +6 -0
  2. package/out/checker.d.ts.map +1 -1
  3. package/out/checker.js +28 -7
  4. package/out/checker.js.map +1 -1
  5. package/out/index.d.ts +2 -1
  6. package/out/index.d.ts.map +1 -1
  7. package/out/index.js +3 -1
  8. package/out/index.js.map +1 -1
  9. package/out/reference-manager/build-q-name-def.d.ts.map +1 -1
  10. package/out/reference-manager/build-q-name-def.js +0 -9
  11. package/out/reference-manager/build-q-name-def.js.map +1 -1
  12. package/out/reference-manager/builtin-q-name.d.ts.map +1 -1
  13. package/out/reference-manager/builtin-q-name.js +1 -5
  14. package/out/reference-manager/builtin-q-name.js.map +1 -1
  15. package/out/reference-manager/reference-manager.d.ts.map +1 -1
  16. package/out/reference-manager/reference-manager.js +4 -1
  17. package/out/reference-manager/reference-manager.js.map +1 -1
  18. package/out/reference-manager/symbol-type.d.ts +1 -1
  19. package/out/reference-manager/symbol-type.d.ts.map +1 -1
  20. package/out/reference-manager/symbol-type.js.map +1 -1
  21. package/out/typer/collectGlobalDefs.d.ts.map +1 -1
  22. package/out/typer/collectGlobalDefs.js +3 -1
  23. package/out/typer/collectGlobalDefs.js.map +1 -1
  24. package/out/typer/component-def-manager/utils.d.ts.map +1 -1
  25. package/out/typer/component-def-manager/utils.js +4 -2
  26. package/out/typer/component-def-manager/utils.js.map +1 -1
  27. package/out/typer/dispatch-call.d.ts.map +1 -1
  28. package/out/typer/dispatch-call.js +177 -26
  29. package/out/typer/dispatch-call.js.map +1 -1
  30. package/out/typer/dispatch-def.d.ts.map +1 -1
  31. package/out/typer/dispatch-def.js +6 -2
  32. package/out/typer/dispatch-def.js.map +1 -1
  33. package/out/typer/dispatch-expr.d.ts +4 -2
  34. package/out/typer/dispatch-expr.d.ts.map +1 -1
  35. package/out/typer/dispatch-expr.js +111 -18
  36. package/out/typer/dispatch-expr.js.map +1 -1
  37. package/out/typer/dispatch-stmt.d.ts.map +1 -1
  38. package/out/typer/dispatch-stmt.js +1 -0
  39. package/out/typer/dispatch-stmt.js.map +1 -1
  40. package/out/typer/dispatch-view.js +1 -1
  41. package/out/typer/dispatch-view.js.map +1 -1
  42. package/out/typer/get-export-interfaces-files.d.ts +8 -0
  43. package/out/typer/get-export-interfaces-files.d.ts.map +1 -0
  44. package/out/typer/get-export-interfaces-files.js +31 -0
  45. package/out/typer/get-export-interfaces-files.js.map +1 -0
  46. package/out/typer/get-origin-logic-files.d.ts +1 -1
  47. package/out/typer/get-origin-logic-files.js +1 -1
  48. package/out/typer/index.d.ts +2 -1
  49. package/out/typer/index.d.ts.map +1 -1
  50. package/out/typer/index.js +3 -1
  51. package/out/typer/index.js.map +1 -1
  52. package/out/typer/oql-checker/chain-call-transformer.d.ts +21 -0
  53. package/out/typer/oql-checker/chain-call-transformer.d.ts.map +1 -0
  54. package/out/typer/oql-checker/chain-call-transformer.js +150 -0
  55. package/out/typer/oql-checker/chain-call-transformer.js.map +1 -0
  56. package/out/typer/oql-checker/ts-parser.d.ts +46 -0
  57. package/out/typer/oql-checker/ts-parser.d.ts.map +1 -0
  58. package/out/typer/oql-checker/ts-parser.js +706 -0
  59. package/out/typer/oql-checker/ts-parser.js.map +1 -0
  60. package/out/typer/oql-checker/ts-printer.d.ts +3 -0
  61. package/out/typer/oql-checker/ts-printer.d.ts.map +1 -0
  62. package/out/typer/oql-checker/ts-printer.js +37 -0
  63. package/out/typer/oql-checker/ts-printer.js.map +1 -0
  64. package/out/typer/overload-helper.d.ts +17 -6
  65. package/out/typer/overload-helper.d.ts.map +1 -1
  66. package/out/typer/overload-helper.js +393 -76
  67. package/out/typer/overload-helper.js.map +1 -1
  68. package/out/typer/subster.d.ts.map +1 -1
  69. package/out/typer/subster.js +70 -2
  70. package/out/typer/subster.js.map +1 -1
  71. package/out/typer/type-manager.js +4 -4
  72. package/out/typer/type-manager.js.map +1 -1
  73. package/out/typer/type-predicate.d.ts +9 -0
  74. package/out/typer/type-predicate.d.ts.map +1 -1
  75. package/out/typer/type-predicate.js +14 -1
  76. package/out/typer/type-predicate.js.map +1 -1
  77. package/out/typer/typer.d.ts +13 -3
  78. package/out/typer/typer.d.ts.map +1 -1
  79. package/out/typer/typer.js +21 -5
  80. package/out/typer/typer.js.map +1 -1
  81. package/out/typer/unifier.d.ts.map +1 -1
  82. package/out/typer/unifier.js +4 -5
  83. package/out/typer/unifier.js.map +1 -1
  84. package/out/utils/debug.d.ts +6 -0
  85. package/out/utils/debug.d.ts.map +1 -0
  86. package/out/utils/debug.js +62 -0
  87. package/out/utils/debug.js.map +1 -0
  88. package/out/utils/file-node-cache.d.ts.map +1 -1
  89. package/out/utils/file-node-cache.js +4 -1
  90. package/out/utils/file-node-cache.js.map +1 -1
  91. package/out/utils/internal-tuple.d.ts +2 -0
  92. package/out/utils/internal-tuple.d.ts.map +1 -0
  93. package/out/utils/internal-tuple.js +29 -0
  94. package/out/utils/internal-tuple.js.map +1 -0
  95. package/out/utils/parseTsClassType.d.ts +1 -5
  96. package/out/utils/parseTsClassType.d.ts.map +1 -1
  97. package/out/utils/parseTsClassType.js +103 -66
  98. package/out/utils/parseTsClassType.js.map +1 -1
  99. package/out/utils/type-operator.d.ts +29 -1
  100. package/out/utils/type-operator.d.ts.map +1 -1
  101. package/out/utils/type-operator.js +181 -1
  102. package/out/utils/type-operator.js.map +1 -1
  103. package/out/utils/type-operators/CheckUniqueKeys.d.ts +15 -0
  104. package/out/utils/type-operators/CheckUniqueKeys.d.ts.map +1 -0
  105. package/out/utils/type-operators/CheckUniqueKeys.js +86 -0
  106. package/out/utils/type-operators/CheckUniqueKeys.js.map +1 -0
  107. package/package.json +11 -6
package/out/checker.d.ts CHANGED
@@ -42,6 +42,12 @@ export declare function createErrorDiagnoser(context: DiagnoseContext): {
42
42
  clearDiagnostics: (node?: SyntaxNode) => void;
43
43
  getDiagnostics: (node: SyntaxNode) => NodeDiagnosticsMap | undefined;
44
44
  getAllDiagnostics: () => FileDiagnosticsMap;
45
+ getDebugDiagnostics: () => {
46
+ message: string;
47
+ severity: string;
48
+ nodePath: string;
49
+ nodeConcept: string;
50
+ }[];
45
51
  error: (node: SyntaxNode, message: string, context?: ErrorContext) => void;
46
52
  };
47
53
  export interface DiagnosticRecord {
@@ -1 +1 @@
1
- {"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../src/checker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EAU0F,GAAG,EAMvG,QAAQ,EACT,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACgE,cAAc,EAGpF,MAAM,qBAAqB,CAAC;AAS7B,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAK5C,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAKpE,oBAAY,QAAQ;IAClB,IAAI,YAAY;IAChB,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,UAAU,GAAG,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAEnE,KAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAMF,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;AAEpE,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;AAMrE,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAqBF,KAAK,eAAe,GAAG;IACrB,GAAG,EAAE,GAAG,CAAC;IACT,G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;IAChB,iBAAiB,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACrC,mBAAmB,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACvC,qBAAqB,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CAC1C;AAMD,eAAO,MAAM,6BAA6B,aAC9B,UAAU,+DAGnB,MAAM,gBAAgB,CAyCxB,CAAC;AAMF,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
package/out/checker.js CHANGED
@@ -1785,6 +1785,9 @@ function createErrorDiagnoser(context) {
1785
1785
  */
1786
1786
  function* checkMcpInterface(node) {
1787
1787
  env.enterScope(node);
1788
+ if (!node.originLogic) {
1789
+ error(node, `MCP工具 ${node.title || node.name} 缺少对应逻辑 ${node.originLogicName}`);
1790
+ }
1788
1791
  if (node.params?.length) {
1789
1792
  yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.params, function* (node) {
1790
1793
  yield* checkNode(node);
@@ -2028,9 +2031,6 @@ function createErrorDiagnoser(context) {
2028
2031
  yield* checkNode(node);
2029
2032
  });
2030
2033
  }
2031
- if (node._foldInView) {
2032
- error(node, `组件${node.name}已经极速折叠`);
2033
- }
2034
2034
  // 已知:选择器会漏报,因为 children 里是两个空 template。暂时先这样吧。
2035
2035
  let dsFilled = true;
2036
2036
  let errNode = node;
@@ -2545,7 +2545,7 @@ function createErrorDiagnoser(context) {
2545
2545
  return;
2546
2546
  }
2547
2547
  // 枚举会被转为 String
2548
- else if (logicParam.typeKind === 'reference' && logicParam.typeNamespace?.endsWith('enums')) {
2548
+ else if (exportInterface.concept !== 'McpInterface' && logicParam.typeKind === 'reference' && logicParam.typeNamespace?.endsWith('enums')) {
2549
2549
  if (param.typeAnnotation.typeName !== 'String') {
2550
2550
  isSame = false;
2551
2551
  return;
@@ -4384,6 +4384,26 @@ function createErrorDiagnoser(context) {
4384
4384
  function getAllDiagnostics() {
4385
4385
  return diagnosticMap;
4386
4386
  }
4387
+ function getDebugDiagnostics() {
4388
+ const diagMap = getAllDiagnostics();
4389
+ const flattenedDiags = [];
4390
+ diagMap.forEach((item) => {
4391
+ flattenedDiags.push(...[...item.entries()].flatMap((([node, xs]) => {
4392
+ return xs.flatMap((x) => {
4393
+ if (!x.message || !x.severity) {
4394
+ return [];
4395
+ }
4396
+ return [{
4397
+ message: x.message,
4398
+ severity: x.severity,
4399
+ nodePath: node.nodePath,
4400
+ nodeConcept: node.concept,
4401
+ }];
4402
+ });
4403
+ })));
4404
+ });
4405
+ return flattenedDiags;
4406
+ }
4387
4407
  return {
4388
4408
  setMetadataTypeEnable,
4389
4409
  setLatestVersionsOfSharedApp,
@@ -4392,6 +4412,7 @@ function createErrorDiagnoser(context) {
4392
4412
  clearDiagnostics,
4393
4413
  getDiagnostics,
4394
4414
  getAllDiagnostics,
4415
+ getDebugDiagnostics,
4395
4416
  error,
4396
4417
  };
4397
4418
  }
@@ -4445,7 +4466,7 @@ exports.transformDiagnosticsToRecords = transformDiagnosticsToRecords;
4445
4466
  // @ts-expect-error
4446
4467
  const toRaw = (nd) => nd.__v_raw ?? nd;
4447
4468
  // 是否来自系统内置
4448
- const isBuiltInCall = (nd) => nd.calleeNamespace.startsWith('nasl.');
4449
- // 是否来自依赖库
4450
- const getExtensionLibName = (nd) => nd.calleeNamespace.startsWith('extensions.') ? nd.calleeNamespace.split('.')[1] : undefined;
4469
+ const isBuiltInCall = (nd) => !!nd.calleeNamespace?.startsWith('nasl.');
4470
+ // 获取依赖库名
4471
+ const getExtensionLibName = (nd) => nd.calleeNamespace?.startsWith('extensions.') ? nd.calleeNamespace.split('.')[1] : undefined;
4451
4472
  //# sourceMappingURL=checker.js.map