@lcap/nasl-language-server-core 4.0.0-beta.2 → 4.0.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.
- package/out/checker.d.ts +3 -3
- package/out/checker.d.ts.map +1 -1
- package/out/checker.js +32 -27
- package/out/checker.js.map +1 -1
- package/out/index.js +7 -17
- package/out/index.js.map +1 -1
- package/out/module/graph.d.ts.map +1 -1
- package/out/reference-manager/builtin-q-name.d.ts.map +1 -1
- package/out/reference-manager/builtin-q-name.js +20 -13
- package/out/reference-manager/builtin-q-name.js.map +1 -1
- package/out/reference-manager/collect-q-name.d.ts +12 -2
- package/out/reference-manager/collect-q-name.d.ts.map +1 -1
- package/out/reference-manager/collect-q-name.js +186 -55
- package/out/reference-manager/collect-q-name.js.map +1 -1
- package/out/reference-manager/get-q-name.d.ts +11 -0
- package/out/reference-manager/get-q-name.d.ts.map +1 -0
- package/out/reference-manager/get-q-name.js +213 -0
- package/out/reference-manager/get-q-name.js.map +1 -0
- package/out/reference-manager/reference-manager.d.ts +79 -92
- package/out/reference-manager/reference-manager.d.ts.map +1 -1
- package/out/reference-manager/reference-manager.js +638 -934
- package/out/reference-manager/reference-manager.js.map +1 -1
- package/out/reference-manager/remove-q-name.d.ts +11 -1
- package/out/reference-manager/remove-q-name.d.ts.map +1 -1
- package/out/reference-manager/remove-q-name.js +149 -15
- package/out/reference-manager/remove-q-name.js.map +1 -1
- package/out/reference-manager/rename-q-name.d.ts +12 -1
- package/out/reference-manager/rename-q-name.d.ts.map +1 -1
- package/out/reference-manager/rename-q-name.js +109 -1
- package/out/reference-manager/rename-q-name.js.map +1 -1
- package/out/reference-manager/symbol-type.d.ts +21 -0
- package/out/reference-manager/symbol-type.d.ts.map +1 -0
- package/out/reference-manager/symbol-type.js +104 -0
- package/out/reference-manager/symbol-type.js.map +1 -0
- package/out/reference-manager/update-nasl-fragment.d.ts +51 -0
- package/out/reference-manager/update-nasl-fragment.d.ts.map +1 -0
- package/out/reference-manager/update-nasl-fragment.js +266 -0
- package/out/reference-manager/update-nasl-fragment.js.map +1 -0
- package/out/symbol/graph.d.ts +1 -1
- package/out/symbol/namespace.d.ts.map +1 -1
- package/out/symbol/symbol.d.ts.map +1 -1
- package/out/symbol/traverse/concepts/frontend/view.js +2 -2
- package/out/symbol/traverse/concepts/frontend/view.js.map +1 -1
- package/out/symbol/traverse/concepts/index.d.ts +1 -2
- package/out/symbol/traverse/concepts/index.d.ts.map +1 -1
- package/out/symbol/traverse/concepts/utils.js +4 -4
- package/out/symbol/traverse/concepts/utils.js.map +1 -1
- package/out/symbol/traverse/traverse.js +2 -1
- package/out/symbol/traverse/traverse.js.map +1 -1
- package/out/symbol/utils.js +2 -1
- package/out/symbol/utils.js.map +1 -1
- package/out/typer/collectGlobalDefs.d.ts +2 -1
- package/out/typer/collectGlobalDefs.d.ts.map +1 -1
- package/out/typer/collectGlobalDefs.js +31 -32
- package/out/typer/collectGlobalDefs.js.map +1 -1
- package/out/typer/component-def-manager/component-def-manager.d.ts +1 -1
- package/out/typer/component-def-manager/component-def-manager.d.ts.map +1 -1
- package/out/typer/component-def-manager/component-def-manager.js +4 -4
- package/out/typer/component-def-manager/component-def-manager.js.map +1 -1
- package/out/typer/component-def-manager/utils.js +4 -3
- package/out/typer/component-def-manager/utils.js.map +1 -1
- package/out/typer/dispatch-all.d.ts +2 -2
- package/out/typer/dispatch-all.d.ts.map +1 -1
- package/out/typer/dispatch-all.js +19 -11
- package/out/typer/dispatch-all.js.map +1 -1
- package/out/typer/dispatch-def.d.ts +3 -2
- package/out/typer/dispatch-def.d.ts.map +1 -1
- package/out/typer/dispatch-def.js +35 -26
- package/out/typer/dispatch-def.js.map +1 -1
- package/out/typer/dispatch-expr.d.ts +1 -1
- package/out/typer/dispatch-expr.d.ts.map +1 -1
- package/out/typer/dispatch-expr.js +150 -114
- package/out/typer/dispatch-expr.js.map +1 -1
- package/out/typer/dispatch-process.d.ts +1 -2
- package/out/typer/dispatch-process.d.ts.map +1 -1
- package/out/typer/dispatch-process.js +73 -41
- package/out/typer/dispatch-process.js.map +1 -1
- package/out/typer/dispatch-stmt.d.ts +1 -0
- package/out/typer/dispatch-stmt.d.ts.map +1 -1
- package/out/typer/dispatch-stmt.js +10 -9
- package/out/typer/dispatch-stmt.js.map +1 -1
- package/out/typer/dispatch-view.d.ts +1 -1
- package/out/typer/dispatch-view.d.ts.map +1 -1
- package/out/typer/dispatch-view.js +49 -18
- package/out/typer/dispatch-view.js.map +1 -1
- package/out/typer/fix-use-before-assign.d.ts.map +1 -1
- package/out/typer/helper.d.ts.map +1 -1
- package/out/typer/helper.js +25 -25
- package/out/typer/helper.js.map +1 -1
- package/out/typer/incremental-update.d.ts +4 -3
- package/out/typer/incremental-update.d.ts.map +1 -1
- package/out/typer/incremental-update.js +173 -85
- package/out/typer/incremental-update.js.map +1 -1
- package/out/typer/index.d.ts +3 -3
- package/out/typer/index.d.ts.map +1 -1
- package/out/typer/index.js +2 -5
- package/out/typer/index.js.map +1 -1
- package/out/typer/nasl-predicate.d.ts +8 -0
- package/out/typer/nasl-predicate.d.ts.map +1 -0
- package/out/typer/nasl-predicate.js +19 -0
- package/out/typer/nasl-predicate.js.map +1 -0
- package/out/typer/query-manager/query-manager.d.ts.map +1 -1
- package/out/typer/query-manager/query-manager.js +2 -1
- package/out/typer/query-manager/query-manager.js.map +1 -1
- package/out/typer/sem-diag.d.ts +1 -1
- package/out/typer/sem-diag.d.ts.map +1 -1
- package/out/typer/sem-diag.js +3 -3
- package/out/typer/sem-diag.js.map +1 -1
- package/out/typer/solver.d.ts.map +1 -1
- package/out/typer/solver.js +14 -6
- package/out/typer/solver.js.map +1 -1
- package/out/typer/subster.d.ts +1 -11
- package/out/typer/subster.d.ts.map +1 -1
- package/out/typer/subster.js +42 -145
- package/out/typer/subster.js.map +1 -1
- package/out/typer/topo-sort.d.ts +1 -1
- package/out/typer/topo-sort.d.ts.map +1 -1
- package/out/typer/topo-sort.js +7 -5
- package/out/typer/topo-sort.js.map +1 -1
- package/out/typer/type-manager.d.ts +5 -11
- package/out/typer/type-manager.d.ts.map +1 -1
- package/out/typer/type-manager.js +94 -99
- package/out/typer/type-manager.js.map +1 -1
- package/out/typer/type-predicate.d.ts +1 -1
- package/out/typer/type-predicate.d.ts.map +1 -1
- package/out/typer/type-predicate.js +19 -8
- package/out/typer/type-predicate.js.map +1 -1
- package/out/typer/typer.d.ts +5 -6
- package/out/typer/typer.d.ts.map +1 -1
- package/out/typer/typer.js +34 -21
- package/out/typer/typer.js.map +1 -1
- package/out/typer/unifier.d.ts +6 -6
- package/out/typer/unifier.d.ts.map +1 -1
- package/out/typer/unifier.js +16 -14
- package/out/typer/unifier.js.map +1 -1
- package/out/utils/array.js +2 -1
- package/out/utils/array.js.map +1 -1
- package/out/utils/assertion.js +2 -1
- package/out/utils/assertion.js.map +1 -1
- package/out/utils/bind-expression-hack.js +9 -18
- package/out/utils/bind-expression-hack.js.map +1 -1
- package/out/utils/error-boundary.d.ts.map +1 -1
- package/out/utils/error-boundary.js +2 -1
- package/out/utils/error-boundary.js.map +1 -1
- package/out/utils/fp-macros.d.ts +16 -0
- package/out/utils/fp-macros.d.ts.map +1 -0
- package/out/utils/fp-macros.js +82 -0
- package/out/utils/fp-macros.js.map +1 -0
- package/out/utils/nasl-type-manipulation.js +5 -4
- package/out/utils/nasl-type-manipulation.js.map +1 -1
- package/out/utils/parseTsClassType.d.ts +11 -10
- package/out/utils/parseTsClassType.d.ts.map +1 -1
- package/out/utils/parseTsClassType.js +50 -43
- package/out/utils/parseTsClassType.js.map +1 -1
- package/out/utils/reference-hack.d.ts +4 -0
- package/out/utils/reference-hack.d.ts.map +1 -0
- package/out/utils/reference-hack.js +14 -0
- package/out/utils/reference-hack.js.map +1 -0
- package/out/utils/type-operator.d.ts +17 -0
- package/out/utils/type-operator.d.ts.map +1 -1
- package/out/utils/type-operator.js +86 -1
- package/out/utils/type-operator.js.map +1 -1
- package/out/utils/types.js +2 -1
- package/out/utils/types.js.map +1 -1
- package/out/utils/vue-hack.js +2 -1
- package/out/utils/vue-hack.js.map +1 -1
- package/out/utils/vue.js +2 -1
- package/out/utils/vue.js.map +1 -1
- package/package.json +9 -6
package/out/checker.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SyntaxNode, App, BaseNode } from '@lcap/nasl-concepts';
|
|
2
2
|
import { TypeAnnotation } from '@lcap/nasl-concepts';
|
|
3
|
-
import { SemEnv } from './typer';
|
|
3
|
+
import { type SemEnv } from './typer';
|
|
4
4
|
export declare enum Severity {
|
|
5
5
|
WARN = "warning",
|
|
6
6
|
ERROR = "error"
|
|
@@ -37,10 +37,10 @@ export declare function createErrorDiagnoser(context: DiagnoseContext): {
|
|
|
37
37
|
setLatestVersionsOfSharedApp: (sharedAppVersions: SharedAppVersion[]) => void;
|
|
38
38
|
diagnosticApp: () => Generator<TypeAnnotation | {
|
|
39
39
|
typeKind: string;
|
|
40
|
-
} | undefined, void,
|
|
40
|
+
} | undefined, void, unknown>;
|
|
41
41
|
checkNode: (node: SyntaxNode | undefined) => Generator<TypeAnnotation | {
|
|
42
42
|
typeKind: string;
|
|
43
|
-
} | undefined, any,
|
|
43
|
+
} | undefined, any, unknown>;
|
|
44
44
|
clearDiagnostics: (node: SyntaxNode) => void;
|
|
45
45
|
getDiagnostics: (node: SyntaxNode) => NodeDiagnosticsMap | FileDiagnosticsMap | undefined;
|
|
46
46
|
error: (node: SyntaxNode, message: string, context?: ErrorContext) => void;
|
package/out/checker.d.ts.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../src/checker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAA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M,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IAEX,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;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;AAED,eAAO,MAAM,6BAA6B,aAAc,UAAU,sCAAoC,MAAM,gBAAgB,CAmC3H,CAAA"}
|
package/out/checker.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformDiagnosticsToRecords = exports.Severity = void 0;
|
|
4
|
-
exports.createErrorDiagnoser = createErrorDiagnoser;
|
|
3
|
+
exports.transformDiagnosticsToRecords = exports.createErrorDiagnoser = exports.Severity = void 0;
|
|
5
4
|
const decimal_js_1 = require("decimal.js");
|
|
6
5
|
const nasl_concepts_1 = require("@lcap/nasl-concepts");
|
|
7
6
|
const service_1 = require("@lcap/nasl-concepts/service");
|
|
@@ -9,6 +8,7 @@ const nasl_utils_1 = require("@lcap/nasl-utils");
|
|
|
9
8
|
const typer_1 = require("./typer");
|
|
10
9
|
const type_predicate_1 = require("./typer/type-predicate");
|
|
11
10
|
const type_manager_1 = require("./typer/type-manager");
|
|
11
|
+
const nasl_predicate_1 = require("./typer/nasl-predicate");
|
|
12
12
|
var Severity;
|
|
13
13
|
(function (Severity) {
|
|
14
14
|
Severity["WARN"] = "warning";
|
|
@@ -28,19 +28,19 @@ const processV2TaskTitleMap = {
|
|
|
28
28
|
SubmitTask: '执行任务',
|
|
29
29
|
CCTask: '抄送任务',
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const isCallEvent = (node) => node.concept === 'CallEvent';
|
|
39
|
-
// order matters as for speed
|
|
31
|
+
/**
|
|
32
|
+
* 是否属于 控制流节点
|
|
33
|
+
* @param node
|
|
34
|
+
*/
|
|
35
|
+
function isControlFlowNode(node) {
|
|
36
|
+
return nasl_concepts_1.asserts.isStrictEnd(node) || nasl_concepts_1.asserts.isStrictAbort(node) || nasl_concepts_1.asserts.isStrictBreak(node) || nasl_concepts_1.asserts.isStrictContinue(node);
|
|
37
|
+
}
|
|
40
38
|
/**
|
|
41
39
|
* 是否属于 调用表达式
|
|
42
40
|
*/
|
|
43
|
-
|
|
41
|
+
function isCallExpression(node) {
|
|
42
|
+
return nasl_concepts_1.asserts.isCallFunction(node) || nasl_concepts_1.asserts.isCallInterface(node) || nasl_concepts_1.asserts.isCallLogic(node) || nasl_concepts_1.asserts.isCallConnector(node) || nasl_concepts_1.asserts.isCallEvent(node);
|
|
43
|
+
}
|
|
44
44
|
const isEnd = (node) => node.concept === 'End';
|
|
45
45
|
const isAbort = (node) => node.concept === 'Abort';
|
|
46
46
|
const isBreak = (node) => node.concept === 'Break';
|
|
@@ -356,7 +356,7 @@ function createErrorDiagnoser(context) {
|
|
|
356
356
|
*/
|
|
357
357
|
function getStatusOfSharedApp(sharedApp) {
|
|
358
358
|
const version = latestVersionsOfSharedApp?.find((item) => item.name === sharedApp.name && item.provider === sharedApp.provider);
|
|
359
|
-
if (!version) {
|
|
359
|
+
if (!version || !version.version) {
|
|
360
360
|
return 'delete';
|
|
361
361
|
}
|
|
362
362
|
else if (version.version !== sharedApp.version) {
|
|
@@ -561,6 +561,15 @@ function createErrorDiagnoser(context) {
|
|
|
561
561
|
message = 'SQL查询:语句不能为空。';
|
|
562
562
|
}
|
|
563
563
|
else if (nasl_concepts_1.asserts.isDestination(node)) {
|
|
564
|
+
chkDest(node);
|
|
565
|
+
}
|
|
566
|
+
else if (node.concept === 'Argument' && nasl_concepts_1.asserts.isDestination(node.parentNode)) {
|
|
567
|
+
chkDest(node.parentNode);
|
|
568
|
+
}
|
|
569
|
+
if (message) {
|
|
570
|
+
error(node, message);
|
|
571
|
+
}
|
|
572
|
+
function chkDest(node) {
|
|
564
573
|
const processElement = node.getAncestor('ProcessElementV2') ?? node.getAncestor('ProcessElement');
|
|
565
574
|
if (processElement) {
|
|
566
575
|
message = '任务未关联页面';
|
|
@@ -570,9 +579,6 @@ function createErrorDiagnoser(context) {
|
|
|
570
579
|
message = '';
|
|
571
580
|
}
|
|
572
581
|
}
|
|
573
|
-
if (message) {
|
|
574
|
-
error(node, message);
|
|
575
|
-
}
|
|
576
582
|
}
|
|
577
583
|
/**
|
|
578
584
|
* 创建一个未找到定义的实体的错误信息
|
|
@@ -1278,14 +1284,7 @@ function createErrorDiagnoser(context) {
|
|
|
1278
1284
|
const property = dataSourceGroup.getProperty(node.name);
|
|
1279
1285
|
if (property.values?.length) {
|
|
1280
1286
|
property.values.forEach((propertyValue) => {
|
|
1281
|
-
if (
|
|
1282
|
-
// prod 环境数据源未配置数据信息 时,不再给出其他提示
|
|
1283
|
-
// https://projectmanage.netease-official.lcap.163yun.com/dashboard/FeatureDetail?id=2782461488301056
|
|
1284
|
-
if (propertyValue.env === 'dev') {
|
|
1285
|
-
error(node, `数据源配置:数据源${property.name}${propertyValue.envDisplayLabel}未配置数据信息`);
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
else if (propertyValue.value) {
|
|
1287
|
+
if (propertyValue.value) {
|
|
1289
1288
|
const dataSource = node;
|
|
1290
1289
|
// 数据源有连接错误
|
|
1291
1290
|
// 手动插入报错
|
|
@@ -1297,6 +1296,11 @@ function createErrorDiagnoser(context) {
|
|
|
1297
1296
|
}
|
|
1298
1297
|
});
|
|
1299
1298
|
}
|
|
1299
|
+
// prod 环境数据源未配置数据信息 时,不再给出其他提示
|
|
1300
|
+
// https://projectmanage.netease-official.lcap.163yun.com/dashboard/FeatureDetail?id=2782461488301056
|
|
1301
|
+
if (!node.devConfigId) {
|
|
1302
|
+
error(node, `数据源配置:数据源${property.name}开发环境未配置数据信息`);
|
|
1303
|
+
}
|
|
1300
1304
|
}
|
|
1301
1305
|
dbType = '';
|
|
1302
1306
|
}
|
|
@@ -3872,7 +3876,7 @@ function createErrorDiagnoser(context) {
|
|
|
3872
3876
|
if (ensureNodeKeyExists(node, 'typeName') && node.typeKind === 'reference') {
|
|
3873
3877
|
const ref = env.resolveRef(node);
|
|
3874
3878
|
if (!ref) {
|
|
3875
|
-
error(node,
|
|
3879
|
+
error(node, `找不到类型 ${node.typeName}`);
|
|
3876
3880
|
}
|
|
3877
3881
|
}
|
|
3878
3882
|
}
|
|
@@ -3950,7 +3954,7 @@ function createErrorDiagnoser(context) {
|
|
|
3950
3954
|
function* dispatchNode(node) {
|
|
3951
3955
|
try {
|
|
3952
3956
|
// 调用表达式
|
|
3953
|
-
if (
|
|
3957
|
+
if ((0, nasl_predicate_1.isNaslCallExpr)(node)) {
|
|
3954
3958
|
return yield* checkCallExpression(node);
|
|
3955
3959
|
}
|
|
3956
3960
|
const { concept } = node;
|
|
@@ -4289,11 +4293,12 @@ function createErrorDiagnoser(context) {
|
|
|
4289
4293
|
error,
|
|
4290
4294
|
};
|
|
4291
4295
|
}
|
|
4296
|
+
exports.createErrorDiagnoser = createErrorDiagnoser;
|
|
4292
4297
|
const transformDiagnosticsToRecords = (fileNode, diagnostics) => {
|
|
4293
4298
|
const records = [];
|
|
4294
4299
|
let filePath;
|
|
4295
4300
|
try {
|
|
4296
|
-
filePath = fileNode.getEmbeddedFilePath();
|
|
4301
|
+
filePath = fileNode.concept !== 'App' ? fileNode.getEmbeddedFilePath() : undefined;
|
|
4297
4302
|
}
|
|
4298
4303
|
catch (err) {
|
|
4299
4304
|
console.log(err);
|