@nasl/cli 0.1.2 → 0.1.4

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 (70) hide show
  1. package/README.md +5 -5
  2. package/build/index.html +6 -6
  3. package/build/index.js +21 -17
  4. package/build/nasl.bundle.js +59104 -8
  5. package/build/webpack.config.js +74 -45
  6. package/out/apis/createAxios.d.ts +2 -0
  7. package/out/apis/createAxios.d.ts.map +1 -0
  8. package/out/apis/createAxios.js +17 -0
  9. package/out/apis/createAxios.js.map +1 -0
  10. package/out/apis/index.d.ts +2 -2
  11. package/out/apis/index.d.ts.map +1 -1
  12. package/out/apis/index.js +6 -6
  13. package/out/apis/index.js.map +1 -1
  14. package/out/bin/nasl.js +26 -7
  15. package/out/bin/nasl.js.map +1 -1
  16. package/out/bin/naslc.js +1 -1
  17. package/out/bin/naslc.js.map +1 -1
  18. package/out/commands/build.d.ts +8 -0
  19. package/out/commands/build.d.ts.map +1 -0
  20. package/out/commands/build.js +54 -0
  21. package/out/commands/build.js.map +1 -0
  22. package/out/commands/check.d.ts +2 -1
  23. package/out/commands/check.d.ts.map +1 -1
  24. package/out/commands/check.js +20 -12
  25. package/out/commands/check.js.map +1 -1
  26. package/out/commands/compile.d.ts +4 -3
  27. package/out/commands/compile.d.ts.map +1 -1
  28. package/out/commands/compile.js +8 -10
  29. package/out/commands/compile.js.map +1 -1
  30. package/out/commands/dep.d.ts +1 -1
  31. package/out/commands/dep.d.ts.map +1 -1
  32. package/out/commands/dep.js +3 -3
  33. package/out/commands/dep.js.map +1 -1
  34. package/out/commands/dev.d.ts +7 -1
  35. package/out/commands/dev.d.ts.map +1 -1
  36. package/out/commands/dev.js +14 -4
  37. package/out/commands/dev.js.map +1 -1
  38. package/out/commands/index.d.ts +3 -1
  39. package/out/commands/index.d.ts.map +1 -1
  40. package/out/commands/index.js +3 -1
  41. package/out/commands/index.js.map +1 -1
  42. package/out/commands/init.d.ts +1 -1
  43. package/out/commands/init.d.ts.map +1 -1
  44. package/out/commands/init.js +2 -2
  45. package/out/commands/init.js.map +1 -1
  46. package/out/index.d.ts +2 -11
  47. package/out/index.d.ts.map +1 -1
  48. package/out/index.js +2 -11
  49. package/out/index.js.map +1 -1
  50. package/out/services/compose.d.ts.map +1 -1
  51. package/out/services/compose.js +29 -2
  52. package/out/services/compose.js.map +1 -1
  53. package/out/services/resolve.d.ts +2 -2
  54. package/out/services/resolve.d.ts.map +1 -1
  55. package/out/services/resolve.js +35 -30
  56. package/out/services/resolve.js.map +1 -1
  57. package/out/types/command.d.ts +4 -0
  58. package/out/types/command.d.ts.map +1 -0
  59. package/out/types/command.js +3 -0
  60. package/out/types/command.js.map +1 -0
  61. package/out/types/config.js +1 -1
  62. package/out/types/index.d.ts +1 -0
  63. package/out/types/index.d.ts.map +1 -1
  64. package/out/types/index.js +1 -0
  65. package/out/types/index.js.map +1 -1
  66. package/out/utils/logger.d.ts +1 -0
  67. package/out/utils/logger.d.ts.map +1 -1
  68. package/out/utils/logger.js +51 -0
  69. package/out/utils/logger.js.map +1 -1
  70. package/package.json +29 -11
package/README.md CHANGED
@@ -57,10 +57,10 @@ nasl compile
57
57
  nasl compile src/app.frontendTypes.pc.frontends.pc.views.dashboard.tsx
58
58
  # 或使用简写
59
59
  naslc src/app.frontendTypes.pc.frontends.pc.views.dashboard.tsx
60
- nasl compile "src/app.enums.*.ts"
61
- nasl compile "src/app.{*.entities.*.ts,structures.*.ts,enums.*.ts}"
62
- nasl compile "src/app.logics.*.ts"
63
- nasl compile "src/*.tsx"
60
+ naslc "src/app.enums.*.ts"
61
+ naslc "src/app.{*.entities.*.ts,structures.*.ts,enums.*.ts}"
62
+ naslc "src/app.logics.*.ts"
63
+ naslc "src/*.tsx"
64
64
  ```
65
65
 
66
66
  ### 检查 NASL 代码
@@ -95,7 +95,7 @@ nasl dep
95
95
  nasl dev
96
96
  ```
97
97
 
98
- 启动开发服务后,默认可以访问 http://localhost:3000 查看预览效果。
98
+ 启动开发服务后,默认可以访问 http://localhost:3100 查看预览效果。
99
99
 
100
100
  ## 开发 CLI 工具
101
101
 
package/build/index.html CHANGED
@@ -7,14 +7,14 @@
7
7
  <!-- <script src="https://ide-sandbox.lcap.codewave-test.163yun.com/dependency/lodash@4.17.21/lodash.js"></script> -->
8
8
  <script src="https://ide-sandbox.lcap.codewave-test.163yun.com/dependency/vue@3.5.13/umd/vue.global.js"></script>
9
9
  <script src="https://ide-sandbox.lcap.codewave-test.163yun.com/dependency/vue-router@4.5.0/umd/vue-router.global.js"></script>
10
- <script src="//minio-api.codewave-test.163yun.com/lowcode-static/packages/@lcap/pc-template-vue3@2.1.0/cloudAdminDesigner.umd.min.js"></script>
11
- <link rel="stylesheet" type="text/css" href="//minio-api.codewave-test.163yun.com/lowcode-static/packages/@lcap/element-plus@1.0.0/dist-theme/index.css" />
12
- <script src="//minio-api.codewave-test.163yun.com/lowcode-static/packages/@lcap/element-plus@1.0.0/dist-theme/index.js"></script>
13
- <script src="//minio-api.codewave-test.163yun.com/lowcode-static/packages/@lcap/element-plus@1.0.0/dist-theme/nasl.ui.json"></script>
14
- <script src="//minio-api.codewave-test.163yun.com/lowcode-static/packages/@lcap/element-plus@1.0.0/dist-theme/i18n.json"></script>
10
+ <script src="//minio-api.codewave-test.163yun.com/lowcode-static/packages/@lcap/pc-template-vue3@2.2.0/cloudAdminDesigner.umd.min.js"></script>
11
+ <link rel="stylesheet" type="text/css" href="//minio-api.codewave-test.163yun.com/lowcode-static/packages/@lcap/element-plus@1.1.0/dist-theme/index.css" />
12
+ <script src="//minio-api.codewave-test.163yun.com/lowcode-static/packages/@lcap/element-plus@1.1.0/dist-theme/index.js"></script>
13
+ <script src="//minio-api.codewave-test.163yun.com/lowcode-static/packages/@lcap/element-plus@1.1.0/dist-theme/nasl.ui.json"></script>
14
+ <script src="//minio-api.codewave-test.163yun.com/lowcode-static/packages/@lcap/element-plus@1.1.0/dist-theme/i18n.json"></script>
15
15
  <link rel="stylesheet" type="text/css" href="//minio-api.codewave-test.163yun.com/lowcode-static/packages/extension/cw_chart_js@0.2.2/dist-theme/index.css" />
16
16
  <script src="//minio-api.codewave-test.163yun.com/lowcode-static/packages/extension/cw_chart_js@0.2.2/dist-theme/index.js"></script>
17
- <script src="./nasl.bundle.js"></script>
17
+ <script src="/nasl.bundle.js"></script>
18
18
  <!-- webpack will inject bundle.js here -->
19
19
  </head>
20
20
  <body>
package/build/index.js CHANGED
@@ -6,24 +6,26 @@ import '@/backendMock';
6
6
  import { routes, metaData } from '@/router';
7
7
  import '@/index.css';
8
8
 
9
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
10
+
9
11
  // 应用初始化
10
12
  class AppHandler {
11
13
  constructor() {}
12
14
 
13
15
  // 处理路由相关
14
16
  handleRouter() {
15
- messager.sendCommand('getRoutes', [JSON.stringify(routes)]);
16
- window.afterRouter = async (to, from) => {
17
- try {
18
- // 获取 messager 实例
19
- const messager = window.messager;
20
- if (messager && typeof messager.sendCommand === 'function') {
21
- await messager.sendCommand('routeChanged', to.path);
22
- }
23
- } catch (err) {
24
- console.error('路由变化处理失败:', err);
25
- }
26
- };
17
+ // messager.sendCommand('getRoutes', [JSON.stringify(routes)]);
18
+ // window.afterRouter = async (to, from) => {
19
+ // try {
20
+ // // 获取 messager 实例
21
+ // const messager = window.messager;
22
+ // if (messager && typeof messager.sendCommand === 'function') {
23
+ // await messager.sendCommand('routeChanged', to.path);
24
+ // }
25
+ // } catch (err) {
26
+ // console.error('路由变化处理失败:', err);
27
+ // }
28
+ // };
27
29
  }
28
30
 
29
31
  initLogic(options = {}, Basic) {
@@ -63,9 +65,9 @@ class AppHandler {
63
65
  const argNames =
64
66
  func
65
67
  .toString()
66
- .match(/function\s*\w*\((.*?)\)/)?.[1]
68
+ .match(/function\s*\w*\(([^)]*?)\)\s*\{/)?.[1]
67
69
  ?.split(',')
68
- .map((name) => name.replace(/=.*$/, '').trim()) || [];
70
+ .map((name) => name.replace(/=.*$|\/\*.*?\*\//g, '').trim()) || [];
69
71
  const args = argNames.map((name) => body[name]);
70
72
  result = func.call(obj, ...args);
71
73
  }
@@ -89,12 +91,14 @@ class AppHandler {
89
91
  enabled: true,
90
92
  initLogic: this.initLogic,
91
93
  };
92
- window.LcapVueRouterConfig = {
93
- mode: 'abstract'
94
- };
95
94
  let app = await window.cloudAdminDesigner.init(platformConfig.appConfig, platformConfig, routes, { ...metaData, backendApp: window.backendApp, override });
96
95
  app.use(window.Cw_chart_js);
97
96
  app.use(window.ElementPlus);
97
+ window.frontendApp = app;
98
+
99
+ app.config.globalProperties.$utils.__proto__.isArrayInBounds = function (arr, index, canLast) {
100
+ return true;
101
+ }
98
102
  } catch (error) {
99
103
  console.error('Failed to initialize: sandbox:\n', error);
100
104
  }