@dckj-npm/lowcode-code-generator 1.2.23 → 1.2.24

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 (240) hide show
  1. package/CHANGELOG.md +280 -280
  2. package/CONTRIBUTING.md +40 -40
  3. package/README.md +123 -123
  4. package/bin/lowcode-code-generator.js +53 -53
  5. package/dist/cli.js.map +1 -1
  6. package/dist/standalone-loader.esm.js +1 -1
  7. package/dist/standalone-loader.esm.js.map +1 -1
  8. package/dist/standalone-loader.js +1 -1
  9. package/dist/standalone-loader.js.map +1 -1
  10. package/dist/standalone-worker.js.map +1 -1
  11. package/dist/standalone.js.map +1 -1
  12. package/es/index.js.map +1 -1
  13. package/lib/index.js.map +1 -1
  14. package/package.json +156 -156
  15. package/standalone/index.js +6 -6
  16. package/standalone/package.json +5 -5
  17. package/standalone-loader/index.js +2 -2
  18. package/standalone-loader/package.json +6 -6
  19. package/standalone-worker/index.js +6 -6
  20. package/standalone-worker/package.json +5 -5
  21. package/types/analyzer/componentAnalyzer.d.ts +2 -2
  22. package/types/cli/index.d.ts +2 -2
  23. package/types/cli/init-solution.d.ts +4 -4
  24. package/types/cli/run.d.ts +15 -15
  25. package/types/cli/solutions/example-solution.d.ts +4 -4
  26. package/types/config/env.d.ts +1 -1
  27. package/types/const/file.d.ts +2 -2
  28. package/types/const/generator.d.ts +58 -58
  29. package/types/const/index.d.ts +11 -11
  30. package/types/core/jsx/handlers/transformJsExpression.d.ts +5 -5
  31. package/types/core/jsx/handlers/transformThis2Context.d.ts +9 -9
  32. package/types/core/jsx/util/isLiteralAtomicExpr.d.ts +4 -4
  33. package/types/core/jsx/util/isSimpleStraightLiteral.d.ts +3 -3
  34. package/types/core/vue/handlers/transformJsExpression.d.ts +5 -5
  35. package/types/core/vue/handlers/transformThis2Context.d.ts +9 -9
  36. package/types/core/vue/util/isLiteralAtomicExpr.d.ts +4 -4
  37. package/types/core/vue/util/isSimpleStraightLiteral.d.ts +3 -3
  38. package/types/generator/ChunkBuilder.d.ts +23 -23
  39. package/types/generator/CodeBuilder.d.ts +17 -17
  40. package/types/generator/ModuleBuilder.d.ts +7 -7
  41. package/types/generator/ProjectBuilder.d.ts +62 -62
  42. package/types/index.d.ts +260 -260
  43. package/types/parser/SchemaParser.d.ts +25 -25
  44. package/types/plugins/common/esmodule.d.ts +8 -8
  45. package/types/plugins/common/requireUtils.d.ts +3 -3
  46. package/types/plugins/common/styleImport.d.ts +3 -3
  47. package/types/plugins/component/rax/commonDeps.d.ts +3 -3
  48. package/types/plugins/component/rax/const.d.ts +18 -18
  49. package/types/plugins/component/rax/containerClass.d.ts +3 -3
  50. package/types/plugins/component/rax/containerInitState.d.ts +7 -7
  51. package/types/plugins/component/rax/containerInjectContext.d.ts +6 -6
  52. package/types/plugins/component/rax/containerInjectDataSourceEngine.d.ts +12 -12
  53. package/types/plugins/component/rax/containerInjectUtils.d.ts +6 -6
  54. package/types/plugins/component/rax/containerLifeCycle.d.ts +8 -8
  55. package/types/plugins/component/rax/containerMethods.d.ts +6 -6
  56. package/types/plugins/component/rax/jsx.d.ts +8 -8
  57. package/types/plugins/component/react/const.d.ts +9 -9
  58. package/types/plugins/component/react/containerClass.d.ts +3 -3
  59. package/types/plugins/component/react/containerInitState.d.ts +7 -7
  60. package/types/plugins/component/react/containerInjectConstants.d.ts +6 -6
  61. package/types/plugins/component/react/containerInjectContext.d.ts +6 -6
  62. package/types/plugins/component/react/containerInjectDataSourceEngine.d.ts +23 -23
  63. package/types/plugins/component/react/containerInjectI18n.d.ts +6 -6
  64. package/types/plugins/component/react/containerInjectUtils.d.ts +8 -8
  65. package/types/plugins/component/react/containerLifeCycle.d.ts +9 -9
  66. package/types/plugins/component/react/containerMethod.d.ts +6 -6
  67. package/types/plugins/component/react/jsx.d.ts +7 -7
  68. package/types/plugins/component/react/reactCommonDeps.d.ts +3 -3
  69. package/types/plugins/component/style/css.d.ts +7 -7
  70. package/types/plugins/component/vue/apiImport.d.ts +23 -23
  71. package/types/plugins/component/vue/containerInitVariable.d.ts +7 -7
  72. package/types/plugins/component/vue/containerInjectDataSourceEngine.d.ts +23 -23
  73. package/types/plugins/component/vue/containerLifeCycle.d.ts +9 -9
  74. package/types/plugins/component/vue/containerMethod.d.ts +6 -6
  75. package/types/plugins/component/vue/containerVue.d.ts +3 -3
  76. package/types/plugins/component/vue/convert/convert-function.d.ts +6 -6
  77. package/types/plugins/component/vue/convert/convert-variable.d.ts +11 -11
  78. package/types/plugins/component/vue/dataSourceMap.d.ts +7 -7
  79. package/types/plugins/component/vue/esmodule.d.ts +8 -8
  80. package/types/plugins/component/vue/routerSecond.d.ts +3 -3
  81. package/types/plugins/component/vue/template.d.ts +7 -7
  82. package/types/plugins/component/vue/vueCommonDeps.d.ts +3 -3
  83. package/types/plugins/project/constants.d.ts +3 -3
  84. package/types/plugins/project/framework/icejs/index.d.ts +11 -11
  85. package/types/plugins/project/framework/icejs/plugins/entry.d.ts +3 -3
  86. package/types/plugins/project/framework/icejs/plugins/entryHtml.d.ts +3 -3
  87. package/types/plugins/project/framework/icejs/plugins/globalStyle.d.ts +3 -3
  88. package/types/plugins/project/framework/icejs/plugins/packageJSON.d.ts +26 -26
  89. package/types/plugins/project/framework/icejs/plugins/router.d.ts +3 -3
  90. package/types/plugins/project/framework/icejs/template/files/README.md.d.ts +2 -2
  91. package/types/plugins/project/framework/icejs/template/files/abc.json.d.ts +2 -2
  92. package/types/plugins/project/framework/icejs/template/files/build.json.d.ts +2 -2
  93. package/types/plugins/project/framework/icejs/template/files/editorconfig.d.ts +2 -2
  94. package/types/plugins/project/framework/icejs/template/files/eslintignore.d.ts +2 -2
  95. package/types/plugins/project/framework/icejs/template/files/eslintrc.js.d.ts +2 -2
  96. package/types/plugins/project/framework/icejs/template/files/gitignore.d.ts +2 -2
  97. package/types/plugins/project/framework/icejs/template/files/jsconfig.json.d.ts +2 -2
  98. package/types/plugins/project/framework/icejs/template/files/prettierignore.d.ts +2 -2
  99. package/types/plugins/project/framework/icejs/template/files/prettierrc.js.d.ts +2 -2
  100. package/types/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Footer/index.jsx.d.ts +2 -2
  101. package/types/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Footer/index.style.d.ts +2 -2
  102. package/types/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Logo/index.jsx.d.ts +2 -2
  103. package/types/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/Logo/index.style.d.ts +2 -2
  104. package/types/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/components/PageNav/index.jsx.d.ts +2 -2
  105. package/types/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/index.jsx.d.ts +2 -2
  106. package/types/plugins/project/framework/icejs/template/files/src/layouts/BasicLayout/menuConfig.js.d.ts +2 -2
  107. package/types/plugins/project/framework/icejs/template/files/stylelintignore.d.ts +2 -2
  108. package/types/plugins/project/framework/icejs/template/files/stylelintrc.js.d.ts +2 -2
  109. package/types/plugins/project/framework/icejs/template/files/tsconfig.json.d.ts +2 -2
  110. package/types/plugins/project/framework/icejs/template/index.d.ts +3 -3
  111. package/types/plugins/project/framework/icejs/template/static-files.d.ts +2 -2
  112. package/types/plugins/project/framework/icejs3/index.d.ts +11 -11
  113. package/types/plugins/project/framework/icejs3/plugins/appConfig.d.ts +5 -5
  114. package/types/plugins/project/framework/icejs3/plugins/buildConfig.d.ts +7 -7
  115. package/types/plugins/project/framework/icejs3/plugins/globalStyle.d.ts +3 -3
  116. package/types/plugins/project/framework/icejs3/plugins/layout.d.ts +3 -3
  117. package/types/plugins/project/framework/icejs3/plugins/packageJSON.d.ts +26 -26
  118. package/types/plugins/project/framework/icejs3/template/files/README.md.d.ts +2 -2
  119. package/types/plugins/project/framework/icejs3/template/files/browserslistrc.d.ts +2 -2
  120. package/types/plugins/project/framework/icejs3/template/files/document.d.ts +2 -2
  121. package/types/plugins/project/framework/icejs3/template/files/gitignore.d.ts +2 -2
  122. package/types/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Footer/index.jsx.d.ts +2 -2
  123. package/types/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Footer/index.style.d.ts +2 -2
  124. package/types/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Logo/index.jsx.d.ts +2 -2
  125. package/types/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/Logo/index.style.d.ts +2 -2
  126. package/types/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/components/PageNav/index.jsx.d.ts +2 -2
  127. package/types/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/index.jsx.d.ts +2 -2
  128. package/types/plugins/project/framework/icejs3/template/files/src/layouts/BasicLayout/menuConfig.js.d.ts +2 -2
  129. package/types/plugins/project/framework/icejs3/template/files/tsconfig.d.ts +2 -2
  130. package/types/plugins/project/framework/icejs3/template/files/typings.d.ts +2 -2
  131. package/types/plugins/project/framework/icejs3/template/index.d.ts +3 -3
  132. package/types/plugins/project/framework/icejs3/template/static-files.d.ts +2 -2
  133. package/types/plugins/project/framework/rax/index.d.ts +12 -12
  134. package/types/plugins/project/framework/rax/plugins/appConfig.d.ts +4 -4
  135. package/types/plugins/project/framework/rax/plugins/buildConfig.d.ts +4 -4
  136. package/types/plugins/project/framework/rax/plugins/entry.d.ts +4 -4
  137. package/types/plugins/project/framework/rax/plugins/entryDocument.d.ts +7 -7
  138. package/types/plugins/project/framework/rax/plugins/globalStyle.d.ts +6 -6
  139. package/types/plugins/project/framework/rax/plugins/packageJSON.d.ts +4 -4
  140. package/types/plugins/project/framework/rax/template/files/.eslintignore.d.ts +2 -2
  141. package/types/plugins/project/framework/rax/template/files/.eslintrc.js.d.ts +2 -2
  142. package/types/plugins/project/framework/rax/template/files/.gitignore.d.ts +2 -2
  143. package/types/plugins/project/framework/rax/template/files/.prettierignore.d.ts +2 -2
  144. package/types/plugins/project/framework/rax/template/files/.prettierrc.js.d.ts +2 -2
  145. package/types/plugins/project/framework/rax/template/files/.stylelintignore.d.ts +2 -2
  146. package/types/plugins/project/framework/rax/template/files/.stylelintrc.js.d.ts +2 -2
  147. package/types/plugins/project/framework/rax/template/files/README.md.d.ts +2 -2
  148. package/types/plugins/project/framework/rax/template/files/jsconfig.json.d.ts +2 -2
  149. package/types/plugins/project/framework/rax/template/files/tsconfig.json.d.ts +2 -2
  150. package/types/plugins/project/framework/rax/template/index.d.ts +3 -3
  151. package/types/plugins/project/framework/rax/template/static-files.d.ts +2 -2
  152. package/types/plugins/project/framework/rax/types/RaxFrameworkOptions.d.ts +81 -81
  153. package/types/plugins/project/framework/vuejs3/index.d.ts +11 -11
  154. package/types/plugins/project/framework/vuejs3/plugins/form.d.ts +3 -3
  155. package/types/plugins/project/framework/vuejs3/plugins/hooks.d.ts +3 -3
  156. package/types/plugins/project/framework/vuejs3/plugins/main.d.ts +4 -4
  157. package/types/plugins/project/framework/vuejs3/plugins/packageJSON.d.ts +26 -26
  158. package/types/plugins/project/framework/vuejs3/plugins/router.d.ts +3 -3
  159. package/types/plugins/project/framework/vuejs3/template/files/css/global.scss.d.ts +2 -2
  160. package/types/plugins/project/framework/vuejs3/template/files/css/mixin.scss.d.ts +2 -2
  161. package/types/plugins/project/framework/vuejs3/template/files/css/theme.css.d.ts +2 -2
  162. package/types/plugins/project/framework/vuejs3/template/files/env.d.ts +2 -2
  163. package/types/plugins/project/framework/vuejs3/template/files/eslintignore.d.ts +2 -2
  164. package/types/plugins/project/framework/vuejs3/template/files/eslintrc.yml.d.ts +2 -2
  165. package/types/plugins/project/framework/vuejs3/template/files/gitignore.d.ts +2 -2
  166. package/types/plugins/project/framework/vuejs3/template/files/index.html.d.ts +2 -2
  167. package/types/plugins/project/framework/vuejs3/template/files/npmrc.d.ts +2 -2
  168. package/types/plugins/project/framework/vuejs3/template/files/postcss.config.cjs.d.ts +2 -2
  169. package/types/plugins/project/framework/vuejs3/template/files/prettierignore.d.ts +2 -2
  170. package/types/plugins/project/framework/vuejs3/template/files/prettierrc.yml.d.ts +2 -2
  171. package/types/plugins/project/framework/vuejs3/template/files/src/App.vue.d.ts +2 -2
  172. package/types/plugins/project/framework/vuejs3/template/files/src/main.d.ts +2 -2
  173. package/types/plugins/project/framework/vuejs3/template/files/src/utils/utils.d.ts +2 -2
  174. package/types/plugins/project/framework/vuejs3/template/files/src/views/baseIndexA/tabs.d.ts +2 -2
  175. package/types/plugins/project/framework/vuejs3/template/files/src/views/baseIndexA/welcome.vue.d.ts +2 -2
  176. package/types/plugins/project/framework/vuejs3/template/files/src/vite-env.d.ts +2 -2
  177. package/types/plugins/project/framework/vuejs3/template/files/tsconfig.json.d.ts +2 -2
  178. package/types/plugins/project/framework/vuejs3/template/files/tsconfig.node.json.d.ts +2 -2
  179. package/types/plugins/project/framework/vuejs3/template/files/vite.config.ts.d.ts +2 -2
  180. package/types/plugins/project/framework/vuejs3/template/index.d.ts +3 -3
  181. package/types/plugins/project/framework/vuejs3/template/static-files.d.ts +2 -2
  182. package/types/plugins/project/i18n.d.ts +3 -3
  183. package/types/plugins/project/utils.d.ts +3 -3
  184. package/types/polyfills/buffer.d.ts +1 -1
  185. package/types/postprocessor/index.d.ts +2 -2
  186. package/types/postprocessor/prettier/index.d.ts +8 -8
  187. package/types/publisher/disk/index.d.ts +13 -13
  188. package/types/publisher/disk/utils.d.ts +9 -9
  189. package/types/publisher/zip/index.d.ts +14 -14
  190. package/types/publisher/zip/utils.d.ts +5 -5
  191. package/types/solutions/icejs.d.ts +18 -18
  192. package/types/solutions/icejs3.d.ts +15 -15
  193. package/types/solutions/rax-app.d.ts +27 -27
  194. package/types/solutions/vuejs3.d.ts +22 -22
  195. package/types/standalone-loader.d.ts +17 -17
  196. package/types/standalone-worker.d.ts +1 -1
  197. package/types/standalone.d.ts +260 -260
  198. package/types/types/analyze.d.ts +5 -5
  199. package/types/types/column-type.d.ts +316 -316
  200. package/types/types/core.d.ts +197 -197
  201. package/types/types/datasource-extra-base.d.ts +32 -32
  202. package/types/types/datasource-page-helper.d.ts +30 -30
  203. package/types/types/deps.d.ts +36 -36
  204. package/types/types/error.d.ts +10 -10
  205. package/types/types/file.d.ts +14 -14
  206. package/types/types/index.d.ts +8 -8
  207. package/types/types/intermediate.d.ts +234 -234
  208. package/types/types/jsx.d.ts +34 -34
  209. package/types/types/publisher.d.ts +14 -14
  210. package/types/types/tab.d.ts +6 -6
  211. package/types/utils/OrderedSet.d.ts +9 -9
  212. package/types/utils/Scope.d.ts +12 -12
  213. package/types/utils/ScopeBindings.d.ts +20 -20
  214. package/types/utils/aopHelper.d.ts +2 -2
  215. package/types/utils/apiHandler.d.ts +4 -4
  216. package/types/utils/changeCase.d.ts +10 -10
  217. package/types/utils/columnType.d.ts +1 -1
  218. package/types/utils/common.d.ts +14 -14
  219. package/types/utils/compositeType.d.ts +3 -3
  220. package/types/utils/dataSource.d.ts +17 -17
  221. package/types/utils/debug.d.ts +2 -2
  222. package/types/utils/encodeJsxAttrString.d.ts +1 -1
  223. package/types/utils/errors.d.ts +4 -4
  224. package/types/utils/expressionParser.d.ts +16 -16
  225. package/types/utils/format.d.ts +1 -1
  226. package/types/utils/index.d.ts +15 -15
  227. package/types/utils/jsExpression.d.ts +50 -50
  228. package/types/utils/jsSlot.d.ts +2 -2
  229. package/types/utils/jsxHelpers.d.ts +5 -5
  230. package/types/utils/nodeToJSX.d.ts +32 -32
  231. package/types/utils/nodeToTemplate.d.ts +17 -17
  232. package/types/utils/pathHelper.d.ts +6 -6
  233. package/types/utils/requestHandle.d.ts +77 -77
  234. package/types/utils/resultHelper.d.ts +51 -51
  235. package/types/utils/routerHandle.d.ts +11 -11
  236. package/types/utils/schema.d.ts +24 -24
  237. package/types/utils/templateHelper.d.ts +11 -11
  238. package/types/utils/theme.d.ts +9 -9
  239. package/types/utils/validate.d.ts +8 -8
  240. package/types/utils/version.d.ts +1 -1
package/CONTRIBUTING.md CHANGED
@@ -1,40 +1,40 @@
1
- # 如何共建
2
-
3
- 1. 拉取最新代码,切换到 develop 分支,基于 develop 分支切出一个 feature 或 hotfix 分支
4
- 2. 到 `lowcode-engine` 项目根目录下,执行 `lerna bootstrap && lerna run build --scope "@alilc/lowcode-types"` 来安装依赖并构建
5
- 3. 到 `lowcode-engine/modules/code-generator`下,安装依赖(`npm i`),然后先跑一遍 `npm test` 看看是否所有用例都能通过 (如果网络条件不太好,建议使用 [cnpm - 淘宝提供的中国 NPM 镜像](https://npmmirror.com/))
6
- 4. 在 tests 目录下编写您的需求/问题的测试用例
7
- 5. 修改 src 下的一些代码,然后运行 `npm test` 或 `npm start` 启动 jest 进行调测
8
- 6. 确保所有的测试用例都能通过时,提 MR 给 @牧毅 -- MR 将在 1 个工作日内给您回复意见。
9
-
10
- 当然,欢迎提前私聊沟通 @牧毅,或加入 低代码渲染/出码服务金牌用户群 讨论沟通。
11
-
12
- # FAQ
13
-
14
- ## 如何查看单测覆盖率?
15
-
16
- 执行 `npm test:cov` 命令,这样会自动生成单测覆盖率的报告到 `coverage` 目录下。
17
-
18
- ## 如何只执行一个测试用例?
19
-
20
- ```sh
21
- npm test -t 'demo2-utils-name-alias'
22
- ```
23
-
24
- ## 更新特定测试用例的 expected:
25
-
26
- ```sh
27
- npm test:update-snapshots -t 'demo2-utils-name-alias'
28
- ```
29
-
30
- ## 如何只执行某个测试用例文件?
31
-
32
- 执行 `npx jest 测试用例的文件路径` 即可,如:
33
-
34
- ```sh
35
- npx jest tests/plugins/common/requireUtils.test.ts
36
- ```
37
-
38
- ## 如何调试某个测试用例?
39
-
40
- 建议需要打断点的地方通过 VSCode 打上断点,然后打开 VSCode 的 JavaScript Debug Terminal,在其中执行 `npx jest tests/path/to/your/test/file.ts` 或 `npx jest -t your-test-case-title` 来执行你的测试用例 -- 这样执行到打了断点的语句时会自动断住,以便调试。
1
+ # 如何共建
2
+
3
+ 1. 拉取最新代码,切换到 develop 分支,基于 develop 分支切出一个 feature 或 hotfix 分支
4
+ 2. 到 `lowcode-engine` 项目根目录下,执行 `lerna bootstrap && lerna run build --scope "@alilc/lowcode-types"` 来安装依赖并构建
5
+ 3. 到 `lowcode-engine/modules/code-generator`下,安装依赖(`npm i`),然后先跑一遍 `npm test` 看看是否所有用例都能通过 (如果网络条件不太好,建议使用 [cnpm - 淘宝提供的中国 NPM 镜像](https://npmmirror.com/))
6
+ 4. 在 tests 目录下编写您的需求/问题的测试用例
7
+ 5. 修改 src 下的一些代码,然后运行 `npm test` 或 `npm start` 启动 jest 进行调测
8
+ 6. 确保所有的测试用例都能通过时,提 MR 给 @牧毅 -- MR 将在 1 个工作日内给您回复意见。
9
+
10
+ 当然,欢迎提前私聊沟通 @牧毅,或加入 低代码渲染/出码服务金牌用户群 讨论沟通。
11
+
12
+ # FAQ
13
+
14
+ ## 如何查看单测覆盖率?
15
+
16
+ 执行 `npm test:cov` 命令,这样会自动生成单测覆盖率的报告到 `coverage` 目录下。
17
+
18
+ ## 如何只执行一个测试用例?
19
+
20
+ ```sh
21
+ npm test -t 'demo2-utils-name-alias'
22
+ ```
23
+
24
+ ## 更新特定测试用例的 expected:
25
+
26
+ ```sh
27
+ npm test:update-snapshots -t 'demo2-utils-name-alias'
28
+ ```
29
+
30
+ ## 如何只执行某个测试用例文件?
31
+
32
+ 执行 `npx jest 测试用例的文件路径` 即可,如:
33
+
34
+ ```sh
35
+ npx jest tests/plugins/common/requireUtils.test.ts
36
+ ```
37
+
38
+ ## 如何调试某个测试用例?
39
+
40
+ 建议需要打断点的地方通过 VSCode 打上断点,然后打开 VSCode 的 JavaScript Debug Terminal,在其中执行 `npx jest tests/path/to/your/test/file.ts` 或 `npx jest -t your-test-case-title` 来执行你的测试用例 -- 这样执行到打了断点的语句时会自动断住,以便调试。
package/README.md CHANGED
@@ -1,123 +1,123 @@
1
- # 出码
2
-
3
- 所谓出码,即将低代码编排出的 schema 进行解析并转换成最终可执行的代码的过程。本模块提供有 Icejs 和 Rax 两套框架的出码方案,并提供了强大而灵活的扩展机制。
4
-
5
- ## 使用方法
6
-
7
- ### 1) 通过命令行快速体验
8
-
9
- 欢迎使用命令行工具快速体验:`npx @alilc/lowcode-code-generator -i example-schema.json -o generated -s icejs`
10
-
11
- --其中 example-schema.json 可以从[这里下载](https://unpkg.com/@alilc/lowcode-code-generator@beta/example-schema.json)
12
-
13
- ### 2) 通过设计器插件快速体验
14
-
15
- 1. 安装依赖: `npm install --save @alilc/lowcode-plugin-code-generator`
16
- 2. 注册插件:
17
-
18
- ```ts
19
- import { plugins } from '@alilc/lowcode-engine';
20
- import CodeGenPlugin from '@alilc/lowcode-plugin-code-generator';
21
-
22
- // 在你的初始化函数中:
23
- await plugins.register(CodeGenPlugin);
24
-
25
- // 如果您不希望自动加上出码按钮,则可以这样注册
26
- await plugins.register(CodeGenPlugin, { disableCodeGenActionBtn: true });
27
- ```
28
-
29
- 然后运行你的低代码编辑器项目即可 -- 在设计器的右上角会出现一个“出码”按钮,点击即可在浏览器中出码并预览。
30
-
31
- ### 3)服务端出码接入
32
-
33
- 此代码生成器一开始就是为服务端出码设计的,你可以直接这样来在 node.js 环境中使用:
34
-
35
- 1. 安装依赖: `npm install --save @alilc/lowcode-code-generator`
36
- 2. 引入代码生成器:
37
-
38
- ```js
39
- import CodeGenerator from '@alilc/lowcode-code-generator';
40
- ```
41
-
42
- 3. 创建项目构建器:
43
-
44
- ```js
45
- const projectBuilder = CodeGenerator.solutions.icejs();
46
- ```
47
-
48
- 4. 生成代码
49
-
50
- ```js
51
- const project = await projectBuilder.generateProject(
52
- schema, // 编排搭建出来的 schema
53
- );
54
- ```
55
-
56
- 5. 将生成的代码写入到磁盘中(也可以生成一个 zip 包)
57
-
58
- ```js
59
- // 写入磁盘
60
- await CodeGenerator.publishers.disk().publish({
61
- project, // 上一步生成的 project
62
- outputPath: '/path/to/your/output/dir', // 输出目录
63
- projectSlug: 'your-project-slug', // 项目标识
64
- });
65
-
66
- // 写入到 zip 包
67
- await CodeGenerator.publishers.zip().publish({
68
- project, // 上一步生成的 project
69
- outputPath: '/path/to/your/output/dir', // 输出目录
70
- projectSlug: 'your-project-slug', // 项目标识 -- 对应生成 your-project-slug.zip 文件
71
- });
72
- ```
73
-
74
- 注:一般来说在服务端出码可以跟 github/gitlab, CI 和 CD 流程等一起串起来使用,通常用于优化性能。
75
-
76
- ### 4)浏览器中出码接入
77
-
78
- 随着现在电脑性能和浏览器技术的发展,出码其实已经不必非得在服务端做了,借助于 Web Worker 特性,可以在浏览器中进行出码:
79
-
80
- 1. 安装依赖: `npm install --save @alilc/lowcode-code-generator`
81
- 2. 引入代码生成器:
82
-
83
- ```js
84
- import * as CodeGenerator from '@alilc/lowcode-code-generator/standalone-loader';
85
- ```
86
-
87
- 3. 【可选】提前初始化代码生成器:
88
-
89
- ```js
90
- // 提前初始化下,这样后面用的时候更快(这个 init 内部会提前准备好创建 worker 的一些资源)
91
- await CodeGenerator.init();
92
- ```
93
-
94
- 4. 出码
95
-
96
- ```js
97
- const project = await CodeGenerator.generateCode({
98
- solution: 'icejs', // 出码方案 (目前内置有 icejs 和 rax )
99
- schema, // 编排搭建出来的 schema
100
- });
101
-
102
- console.log(project); // 出码结果(默认是递归结构描述的,可以传 flattenResult: true 以生成扁平结构的结果)
103
- ```
104
-
105
- 注:一般来说在浏览器中出码适合做即时预览功能。
106
-
107
- 5. 下载 zip 包
108
-
109
- ```js
110
- // 写入到 zip 包
111
- await CodeGenerator.publishers.zip().publish({
112
- project, // 上一步生成的 project
113
- projectSlug: 'your-project-slug', // 项目标识 -- 对应下载 your-project-slug.zip 文件
114
- });
115
- ```
116
-
117
- ### 5)自定义出码
118
-
119
- 前端框架灵活多变,默认内置的出码方案很难满足所有人的需求,好在此代码生成器支持非常灵活的插件机制 -- 欢迎参考 ./src/plugins/xxx 来编写您自己的出码插件,然后参考 ./src/solutions/xxx 将各种插件组合成一套适合您的业务场景的出码方案。
120
-
121
- ## 参与共建
122
-
123
- 欢迎参与共建,如何共建请参阅:[./CONTRIBUTING.md](https://github.com/alibaba/lowcode-engine/blob/main/modules/code-generator/CONTRIBUTING.md)
1
+ # 出码
2
+
3
+ 所谓出码,即将低代码编排出的 schema 进行解析并转换成最终可执行的代码的过程。本模块提供有 Icejs 和 Rax 两套框架的出码方案,并提供了强大而灵活的扩展机制。
4
+
5
+ ## 使用方法
6
+
7
+ ### 1) 通过命令行快速体验
8
+
9
+ 欢迎使用命令行工具快速体验:`npx @alilc/lowcode-code-generator -i example-schema.json -o generated -s icejs`
10
+
11
+ --其中 example-schema.json 可以从[这里下载](https://unpkg.com/@alilc/lowcode-code-generator@beta/example-schema.json)
12
+
13
+ ### 2) 通过设计器插件快速体验
14
+
15
+ 1. 安装依赖: `npm install --save @alilc/lowcode-plugin-code-generator`
16
+ 2. 注册插件:
17
+
18
+ ```ts
19
+ import { plugins } from '@alilc/lowcode-engine';
20
+ import CodeGenPlugin from '@alilc/lowcode-plugin-code-generator';
21
+
22
+ // 在你的初始化函数中:
23
+ await plugins.register(CodeGenPlugin);
24
+
25
+ // 如果您不希望自动加上出码按钮,则可以这样注册
26
+ await plugins.register(CodeGenPlugin, { disableCodeGenActionBtn: true });
27
+ ```
28
+
29
+ 然后运行你的低代码编辑器项目即可 -- 在设计器的右上角会出现一个“出码”按钮,点击即可在浏览器中出码并预览。
30
+
31
+ ### 3)服务端出码接入
32
+
33
+ 此代码生成器一开始就是为服务端出码设计的,你可以直接这样来在 node.js 环境中使用:
34
+
35
+ 1. 安装依赖: `npm install --save @alilc/lowcode-code-generator`
36
+ 2. 引入代码生成器:
37
+
38
+ ```js
39
+ import CodeGenerator from '@alilc/lowcode-code-generator';
40
+ ```
41
+
42
+ 3. 创建项目构建器:
43
+
44
+ ```js
45
+ const projectBuilder = CodeGenerator.solutions.icejs();
46
+ ```
47
+
48
+ 4. 生成代码
49
+
50
+ ```js
51
+ const project = await projectBuilder.generateProject(
52
+ schema, // 编排搭建出来的 schema
53
+ );
54
+ ```
55
+
56
+ 5. 将生成的代码写入到磁盘中(也可以生成一个 zip 包)
57
+
58
+ ```js
59
+ // 写入磁盘
60
+ await CodeGenerator.publishers.disk().publish({
61
+ project, // 上一步生成的 project
62
+ outputPath: '/path/to/your/output/dir', // 输出目录
63
+ projectSlug: 'your-project-slug', // 项目标识
64
+ });
65
+
66
+ // 写入到 zip 包
67
+ await CodeGenerator.publishers.zip().publish({
68
+ project, // 上一步生成的 project
69
+ outputPath: '/path/to/your/output/dir', // 输出目录
70
+ projectSlug: 'your-project-slug', // 项目标识 -- 对应生成 your-project-slug.zip 文件
71
+ });
72
+ ```
73
+
74
+ 注:一般来说在服务端出码可以跟 github/gitlab, CI 和 CD 流程等一起串起来使用,通常用于优化性能。
75
+
76
+ ### 4)浏览器中出码接入
77
+
78
+ 随着现在电脑性能和浏览器技术的发展,出码其实已经不必非得在服务端做了,借助于 Web Worker 特性,可以在浏览器中进行出码:
79
+
80
+ 1. 安装依赖: `npm install --save @alilc/lowcode-code-generator`
81
+ 2. 引入代码生成器:
82
+
83
+ ```js
84
+ import * as CodeGenerator from '@alilc/lowcode-code-generator/standalone-loader';
85
+ ```
86
+
87
+ 3. 【可选】提前初始化代码生成器:
88
+
89
+ ```js
90
+ // 提前初始化下,这样后面用的时候更快(这个 init 内部会提前准备好创建 worker 的一些资源)
91
+ await CodeGenerator.init();
92
+ ```
93
+
94
+ 4. 出码
95
+
96
+ ```js
97
+ const project = await CodeGenerator.generateCode({
98
+ solution: 'icejs', // 出码方案 (目前内置有 icejs 和 rax )
99
+ schema, // 编排搭建出来的 schema
100
+ });
101
+
102
+ console.log(project); // 出码结果(默认是递归结构描述的,可以传 flattenResult: true 以生成扁平结构的结果)
103
+ ```
104
+
105
+ 注:一般来说在浏览器中出码适合做即时预览功能。
106
+
107
+ 5. 下载 zip 包
108
+
109
+ ```js
110
+ // 写入到 zip 包
111
+ await CodeGenerator.publishers.zip().publish({
112
+ project, // 上一步生成的 project
113
+ projectSlug: 'your-project-slug', // 项目标识 -- 对应下载 your-project-slug.zip 文件
114
+ });
115
+ ```
116
+
117
+ ### 5)自定义出码
118
+
119
+ 前端框架灵活多变,默认内置的出码方案很难满足所有人的需求,好在此代码生成器支持非常灵活的插件机制 -- 欢迎参考 ./src/plugins/xxx 来编写您自己的出码插件,然后参考 ./src/solutions/xxx 将各种插件组合成一套适合您的业务场景的出码方案。
120
+
121
+ ## 参与共建
122
+
123
+ 欢迎参与共建,如何共建请参阅:[./CONTRIBUTING.md](https://github.com/alibaba/lowcode-engine/blob/main/modules/code-generator/CONTRIBUTING.md)
@@ -1,53 +1,53 @@
1
- #!/usr/bin/env node
2
- /* eslint-disable no-var */
3
- /* eslint-disable prefer-arrow-callback */
4
- /* eslint-disable @typescript-eslint/no-require-imports */
5
-
6
- var program = require('commander');
7
-
8
- program
9
- .command('generate', { isDefault: true })
10
- .description('Generate code from ali lowcode schema')
11
- .requiredOption('-s, --solution <solution>', 'specify the solution to use (icejs/rax/recore)')
12
- .option('-i, --input <input>', 'specify the input schema file')
13
- .option('-r, --resourceList <resourceList>', 'specify the input resourceList file')
14
- .option('-o, --output <output>', 'specify the output directory', 'generated')
15
- .option('-c, --cwd <cwd>', 'specify the working directory', '.')
16
- .option('-q, --quiet', 'be quiet, do not output anything unless get error', false)
17
- .option('-v, --verbose', 'be verbose, output more information', false)
18
- .option('--solution-options <options>', 'specify the solution options', '{}')
19
- .arguments('[input-schema] ali lowcode schema JSON file')
20
- .action(function doGenerate(inputSchema, command) {
21
- var options = command.opts();
22
- if (options.cwd) {
23
- process.chdir(options.cwd);
24
- }
25
-
26
- require('../dist/cli')
27
- .run(inputSchema ? [inputSchema] : [], options)
28
- .then((retCode) => {
29
- process.exit(retCode);
30
- });
31
- });
32
-
33
- program
34
- .command('init-solution')
35
- .option('-c, --cwd <cwd>', 'specify the working directory', '.')
36
- .option('-q, --quiet', 'be quiet, do not output anything unless get error', false)
37
- .option('-v, --verbose', 'be verbose, output more information', false)
38
- .arguments('<your-solution-name>')
39
- .action(function initSolution(solutionName, command) {
40
- var options = command.opts();
41
- if (options.cwd) {
42
- process.chdir(options.cwd);
43
- }
44
-
45
- require('../dist/cli')
46
- .initSolution([solutionName], options)
47
- .then((retCode) => {
48
- process.exit(retCode);
49
- });
50
- });
51
-
52
- program.parse(process.argv);
53
-
1
+ #!/usr/bin/env node
2
+ /* eslint-disable no-var */
3
+ /* eslint-disable prefer-arrow-callback */
4
+ /* eslint-disable @typescript-eslint/no-require-imports */
5
+
6
+ var program = require('commander');
7
+
8
+ program
9
+ .command('generate', { isDefault: true })
10
+ .description('Generate code from ali lowcode schema')
11
+ .requiredOption('-s, --solution <solution>', 'specify the solution to use (icejs/rax/recore)')
12
+ .option('-i, --input <input>', 'specify the input schema file')
13
+ .option('-r, --resourceList <resourceList>', 'specify the input resourceList file')
14
+ .option('-o, --output <output>', 'specify the output directory', 'generated')
15
+ .option('-c, --cwd <cwd>', 'specify the working directory', '.')
16
+ .option('-q, --quiet', 'be quiet, do not output anything unless get error', false)
17
+ .option('-v, --verbose', 'be verbose, output more information', false)
18
+ .option('--solution-options <options>', 'specify the solution options', '{}')
19
+ .arguments('[input-schema] ali lowcode schema JSON file')
20
+ .action(function doGenerate(inputSchema, command) {
21
+ var options = command.opts();
22
+ if (options.cwd) {
23
+ process.chdir(options.cwd);
24
+ }
25
+
26
+ require('../dist/cli')
27
+ .run(inputSchema ? [inputSchema] : [], options)
28
+ .then((retCode) => {
29
+ process.exit(retCode);
30
+ });
31
+ });
32
+
33
+ program
34
+ .command('init-solution')
35
+ .option('-c, --cwd <cwd>', 'specify the working directory', '.')
36
+ .option('-q, --quiet', 'be quiet, do not output anything unless get error', false)
37
+ .option('-v, --verbose', 'be verbose, output more information', false)
38
+ .arguments('<your-solution-name>')
39
+ .action(function initSolution(solutionName, command) {
40
+ var options = command.opts();
41
+ if (options.cwd) {
42
+ process.chdir(options.cwd);
43
+ }
44
+
45
+ require('../dist/cli')
46
+ .initSolution([solutionName], options)
47
+ .then((retCode) => {
48
+ process.exit(retCode);
49
+ });
50
+ });
51
+
52
+ program.parse(process.argv);
53
+