@lcap/nasl 3.12.0-rc.6 → 3.13.0-alpha.microapp-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.
Files changed (55) hide show
  1. package/out/common/Messager.d.ts.map +1 -1
  2. package/out/common/Messager.js +12 -5
  3. package/out/common/Messager.js.map +1 -1
  4. package/out/generator/annotation/utils.js +1 -1
  5. package/out/generator/annotation/utils.js.map +1 -1
  6. package/out/generator/genBundleFiles.d.ts.map +1 -1
  7. package/out/generator/genBundleFiles.js +26 -18
  8. package/out/generator/genBundleFiles.js.map +1 -1
  9. package/out/generator/microApp.d.ts.map +1 -1
  10. package/out/generator/microApp.js +2 -2
  11. package/out/generator/microApp.js.map +1 -1
  12. package/out/generator/qiankun.d.ts +1 -1
  13. package/out/generator/qiankun.d.ts.map +1 -1
  14. package/out/generator/qiankun.js +6 -0
  15. package/out/generator/qiankun.js.map +1 -1
  16. package/out/generator/release-body/body.d.ts +3 -1
  17. package/out/generator/release-body/body.d.ts.map +1 -1
  18. package/out/generator/release-body/body.js +61 -9
  19. package/out/generator/release-body/body.js.map +1 -1
  20. package/out/generator/release-body/data.d.ts +5 -3
  21. package/out/generator/release-body/data.d.ts.map +1 -1
  22. package/out/generator/release-body/data.js +12 -7
  23. package/out/generator/release-body/data.js.map +1 -1
  24. package/out/generator/release-body/internal.d.ts +2 -0
  25. package/out/generator/release-body/internal.d.ts.map +1 -1
  26. package/out/generator/release-body/internal.js.map +1 -1
  27. package/out/generator/release-body/utils.js +4 -4
  28. package/out/generator/release-body/utils.js.map +1 -1
  29. package/out/generator/ui-library-declaration/dependency.d.ts.map +1 -1
  30. package/out/generator/ui-library-declaration/dependency.js +1 -0
  31. package/out/generator/ui-library-declaration/dependency.js.map +1 -1
  32. package/out/generator/wujie.d.ts +3 -0
  33. package/out/generator/wujie.d.ts.map +1 -0
  34. package/out/generator/wujie.js +38 -0
  35. package/out/generator/wujie.js.map +1 -0
  36. package/out/manager/diagnostic.d.ts +1 -1
  37. package/out/manager/diagnostic.d.ts.map +1 -1
  38. package/out/manager/diagnostic.js.map +1 -1
  39. package/out/server/OQL/oql-cache.d.ts +5 -2
  40. package/out/server/OQL/oql-cache.d.ts.map +1 -1
  41. package/out/server/OQL/oql-cache.js +43 -25
  42. package/out/server/OQL/oql-cache.js.map +1 -1
  43. package/out/server/naslServer.d.ts +15 -13
  44. package/out/server/naslServer.d.ts.map +1 -1
  45. package/out/server/naslServer.js +428 -395
  46. package/out/server/naslServer.js.map +1 -1
  47. package/out/server/translator.d.ts.map +1 -1
  48. package/out/server/translator.js +24 -0
  49. package/out/server/translator.js.map +1 -1
  50. package/package.json +13 -12
  51. package/sandbox/stdlib/nasl.langUtil.ts +2 -0
  52. package/sandbox/stdlib/nasl.util.ts +28 -11
  53. package/ts-worker/bundle.js +8 -8
  54. package/ts-worker/lib/Messager.js +19 -4
  55. package/ts-worker/src/index.js +33 -3
@@ -97,11 +97,26 @@ class Messager {
97
97
  }
98
98
  this.sendMessage(message);
99
99
  return new Promise((res, rej) => {
100
- this.requests.set(message.id, Object.assign({ res, rej }, message));
101
- setTimeout(() => {
102
- this.requests.delete(message.id);
103
- rej(Object.assign({ error: 'Timeout' }, message));
100
+ const timeoutTimer = setTimeout(() => {
101
+ this.requests.delete(message.id);
102
+ rej(Object.assign({ error: 'Timeout' }, message));
104
103
  }, this.options.timeout || 2000);
104
+
105
+ const resolve = (data) => {
106
+ // 需要主动把定时器卸载掉,避免内存泄露
107
+ this.requests.delete(message.id);
108
+ clearTimeout(timeoutTimer);
109
+ res(data);
110
+ };
111
+
112
+ const reject = (e) => {
113
+ // 需要主动把定时器卸载掉,避免内存泄露
114
+ this.requests.delete(message.id);
115
+ clearTimeout(timeoutTimer);
116
+ rej(e);
117
+ };
118
+
119
+ this.requests.set(message.id, Object.assign({ res: resolve, rej: reject }, message));
105
120
  });
106
121
  }
107
122
  /**
@@ -349,6 +349,37 @@ const context = {
349
349
  }
350
350
  return result;
351
351
  },
352
+ getSlotCurrentCompletion({ file, range }) {
353
+ let result = [];
354
+ // 获取当前这个位置的可选内容并且只查当前这层
355
+ const completionList = this.getCompletionInfo({ file, range });
356
+ result = this.formatSlotCurrentCompletion(completionList, { file, range }, { noDown: true });
357
+ return result;
358
+ },
359
+ formatSlotCurrentCompletion(completions, { file, range }, methodConfig) {
360
+ const { noDown } = methodConfig;
361
+ const completionList = completions.filter((item) => item.sortText === '11' && item.name.startsWith('current'));
362
+
363
+ const entryNames = [];
364
+ const valueList = [];
365
+ // 遍历取出所有的名称
366
+ completionList.forEach((item) => {
367
+ entryNames.push(item.name);
368
+ valueList.push({
369
+ text: item.name,
370
+ });
371
+ });
372
+ // 找到有子集的对象
373
+ const details = this.completionEntryDetails({ file, range, entryNames }, noDown);
374
+ valueList.forEach((item) => {
375
+ if (details[item.text]) {
376
+ item.children = details[item.text].children;
377
+ item.completionDetail = details[item.text].completionDetail;
378
+ }
379
+ });
380
+ return valueList;
381
+
382
+ },
352
383
  /**
353
384
  * @param {*} completions 查到的依赖
354
385
  * @param {*} { file, range } 文件和位置信息
@@ -356,8 +387,8 @@ const context = {
356
387
  * @param {*} values 继续向下查的数组
357
388
  * @returns
358
389
  */
359
- formatCompletions(completions, { file, range }, mothodConfig) {
360
- const { noDown, values, noFilterList } = mothodConfig;
390
+ formatCompletions(completions, { file, range }, methodConfig) {
391
+ const { noDown, values, noFilterList } = methodConfig;
361
392
  const completionList = completions.filter((item) => {
362
393
  // 过滤别的文件的, 而且过滤arguments 和 导出的,和不要函数
363
394
  // 先过滤掉app
@@ -484,7 +515,6 @@ const context = {
484
515
  });
485
516
  return detailsMap;
486
517
  },
487
- // 增加当前的属性然后·出下面的属性
488
518
  changeValueAndGet({ file, range, value }, noDown, values) {
489
519
  let result;
490
520
  if (value) {