@simplysm/sd-cli 7.3.4 → 10.0.21

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 (468) hide show
  1. package/.eslintrc.cjs +18 -0
  2. package/dist/SdLinter.d.ts +5 -0
  3. package/dist/SdLinter.js.map +1 -0
  4. package/dist/SdLinter.mjs +37 -0
  5. package/dist/SdTsIncrementalBuilder.d.ts +16 -0
  6. package/dist/SdTsIncrementalBuilder.js.map +1 -0
  7. package/dist/SdTsIncrementalBuilder.mjs +54 -0
  8. package/dist/build-cluster.js.map +1 -0
  9. package/dist/build-cluster.mjs +124 -0
  10. package/dist/builders/SdCliClientBuilder.d.ts +13 -0
  11. package/dist/builders/SdCliClientBuilder.js.map +1 -0
  12. package/dist/builders/SdCliClientBuilder.mjs +167 -0
  13. package/dist/builders/SdCliJsLibLinter.d.ts +14 -0
  14. package/dist/builders/SdCliJsLibLinter.js.map +1 -0
  15. package/dist/builders/SdCliJsLibLinter.mjs +60 -0
  16. package/dist/builders/SdCliServerBuilder.d.ts +14 -0
  17. package/dist/builders/SdCliServerBuilder.js.map +1 -0
  18. package/dist/builders/SdCliServerBuilder.mjs +171 -0
  19. package/dist/builders/SdCliTsLibBuilder.d.ts +13 -0
  20. package/dist/builders/SdCliTsLibBuilder.js.map +1 -0
  21. package/dist/builders/SdCliTsLibBuilder.mjs +75 -0
  22. package/dist/commons.d.ts +20 -110
  23. package/dist/commons.js.map +1 -0
  24. package/dist/commons.mjs +1 -1
  25. package/dist/entry/SdCliProject.d.ts +29 -0
  26. package/dist/entry/SdCliProject.js.map +1 -0
  27. package/dist/entry/SdCliProject.mjs +353 -0
  28. package/dist/sd-cli.js.map +1 -0
  29. package/dist/sd-cli.mjs +119 -0
  30. package/dist/sd-core-common/src/decorators/NotifyPropertyChange.d.ts +20 -0
  31. package/dist/sd-core-common/src/decorators/NotifyPropertyChange.js.map +1 -0
  32. package/dist/sd-core-common/src/decorators/NotifyPropertyChange.mjs +12 -0
  33. package/dist/sd-core-common/src/decorators/PropertyGetSetDecoratorBase.d.ts +43 -0
  34. package/dist/sd-core-common/src/decorators/PropertyGetSetDecoratorBase.js.map +1 -0
  35. package/dist/sd-core-common/src/decorators/PropertyGetSetDecoratorBase.mjs +54 -0
  36. package/dist/sd-core-common/src/decorators/PropertyValidate.d.ts +16 -0
  37. package/dist/sd-core-common/src/decorators/PropertyValidate.js.map +1 -0
  38. package/dist/sd-core-common/src/decorators/PropertyValidate.mjs +26 -0
  39. package/dist/sd-core-common/src/decorators/decorator-return-types.d.ts +14 -0
  40. package/dist/sd-core-common/src/decorators/decorator-return-types.js.map +1 -0
  41. package/dist/sd-core-common/src/decorators/decorator-return-types.mjs +2 -0
  42. package/dist/sd-core-common/src/errors/ArgumentError.d.ts +10 -0
  43. package/dist/sd-core-common/src/errors/ArgumentError.js.map +1 -0
  44. package/dist/sd-core-common/src/errors/ArgumentError.mjs +13 -0
  45. package/dist/sd-core-common/src/errors/NeverEntryError.d.ts +10 -0
  46. package/dist/sd-core-common/src/errors/NeverEntryError.js.map +1 -0
  47. package/dist/sd-core-common/src/errors/NeverEntryError.mjs +13 -0
  48. package/dist/sd-core-common/src/errors/NotImplementError.d.ts +10 -0
  49. package/dist/sd-core-common/src/errors/NotImplementError.js.map +1 -0
  50. package/dist/sd-core-common/src/errors/NotImplementError.mjs +13 -0
  51. package/dist/sd-core-common/src/errors/SdError.d.ts +23 -0
  52. package/dist/sd-core-common/src/errors/SdError.js.map +1 -0
  53. package/dist/sd-core-common/src/errors/SdError.mjs +40 -0
  54. package/dist/sd-core-common/src/errors/TimeoutError.d.ts +11 -0
  55. package/dist/sd-core-common/src/errors/TimeoutError.js.map +1 -0
  56. package/dist/sd-core-common/src/errors/TimeoutError.mjs +16 -0
  57. package/dist/sd-core-common/src/extensions/ArrayExtension.d.ts +147 -0
  58. package/dist/sd-core-common/src/extensions/ArrayExtension.js.map +1 -0
  59. package/dist/sd-core-common/src/extensions/ArrayExtension.mjs +448 -0
  60. package/dist/sd-core-common/src/extensions/MapExtension.d.ts +4 -0
  61. package/dist/sd-core-common/src/extensions/MapExtension.js.map +1 -0
  62. package/dist/sd-core-common/src/extensions/MapExtension.mjs +15 -0
  63. package/dist/sd-core-common/src/extensions/SetExtension.d.ts +3 -0
  64. package/dist/sd-core-common/src/extensions/SetExtension.js.map +1 -0
  65. package/dist/sd-core-common/src/extensions/SetExtension.mjs +10 -0
  66. package/dist/sd-core-common/src/index.d.ts +32 -0
  67. package/dist/sd-core-common/src/index.js.map +1 -0
  68. package/dist/sd-core-common/src/index.mjs +33 -0
  69. package/dist/sd-core-common/src/types/DateOnly.d.ts +135 -0
  70. package/dist/sd-core-common/src/types/DateOnly.js.map +1 -0
  71. package/dist/sd-core-common/src/types/DateOnly.mjs +220 -0
  72. package/dist/sd-core-common/src/types/DateTime.d.ts +42 -0
  73. package/dist/sd-core-common/src/types/DateTime.js.map +1 -0
  74. package/dist/sd-core-common/src/types/DateTime.mjs +156 -0
  75. package/dist/sd-core-common/src/types/DeepPartial.d.ts +3 -0
  76. package/dist/sd-core-common/src/types/DeepPartial.js.map +1 -0
  77. package/dist/sd-core-common/src/types/DeepPartial.mjs +2 -0
  78. package/dist/sd-core-common/src/types/ObjectSet.d.ts +4 -0
  79. package/dist/sd-core-common/src/types/ObjectSet.js.map +1 -0
  80. package/dist/sd-core-common/src/types/ObjectSet.mjs +18 -0
  81. package/dist/sd-core-common/src/types/Time.d.ts +27 -0
  82. package/dist/sd-core-common/src/types/Time.js.map +1 -0
  83. package/dist/sd-core-common/src/types/Time.mjs +108 -0
  84. package/dist/sd-core-common/src/types/Type.d.ts +7 -0
  85. package/dist/sd-core-common/src/types/Type.js.map +1 -0
  86. package/dist/sd-core-common/src/types/Type.mjs +2 -0
  87. package/dist/sd-core-common/src/types/UnwrappedType.d.ts +1 -0
  88. package/dist/sd-core-common/src/types/UnwrappedType.js.map +1 -0
  89. package/dist/sd-core-common/src/types/UnwrappedType.mjs +2 -0
  90. package/dist/sd-core-common/src/types/Uuid.d.ts +8 -0
  91. package/dist/sd-core-common/src/types/Uuid.js.map +1 -0
  92. package/dist/sd-core-common/src/types/Uuid.mjs +26 -0
  93. package/dist/sd-core-common/src/types/WrappedType.d.ts +1 -0
  94. package/dist/sd-core-common/src/types/WrappedType.js.map +1 -0
  95. package/dist/sd-core-common/src/types/WrappedType.mjs +2 -0
  96. package/dist/sd-core-common/src/utils/DateTimeFormatUtil.d.ts +12 -0
  97. package/dist/sd-core-common/src/utils/DateTimeFormatUtil.js.map +1 -0
  98. package/dist/sd-core-common/src/utils/DateTimeFormatUtil.mjs +67 -0
  99. package/dist/sd-core-common/src/utils/FunctionQueue.d.ts +8 -0
  100. package/dist/sd-core-common/src/utils/FunctionQueue.js.map +1 -0
  101. package/dist/sd-core-common/src/utils/FunctionQueue.mjs +46 -0
  102. package/dist/sd-core-common/src/utils/FunctionUtil.d.ts +6 -0
  103. package/dist/sd-core-common/src/utils/FunctionUtil.js.map +1 -0
  104. package/dist/sd-core-common/src/utils/FunctionUtil.mjs +31 -0
  105. package/dist/sd-core-common/src/utils/JsonConvert.d.ts +8 -0
  106. package/dist/sd-core-common/src/utils/JsonConvert.js.map +1 -0
  107. package/dist/sd-core-common/src/utils/JsonConvert.mjs +78 -0
  108. package/dist/sd-core-common/src/utils/MathUtil.d.ts +3 -0
  109. package/dist/sd-core-common/src/utils/MathUtil.js.map +1 -0
  110. package/dist/sd-core-common/src/utils/MathUtil.mjs +6 -0
  111. package/dist/sd-core-common/src/utils/NumberUtil.d.ts +6 -0
  112. package/dist/sd-core-common/src/utils/NumberUtil.js.map +1 -0
  113. package/dist/sd-core-common/src/utils/NumberUtil.mjs +32 -0
  114. package/dist/sd-core-common/src/utils/ObjectUtil.d.ts +80 -0
  115. package/dist/sd-core-common/src/utils/ObjectUtil.js.map +1 -0
  116. package/dist/sd-core-common/src/utils/ObjectUtil.mjs +452 -0
  117. package/dist/sd-core-common/src/utils/SdSyncEventEmitter.d.ts +6 -0
  118. package/dist/sd-core-common/src/utils/SdSyncEventEmitter.js.map +1 -0
  119. package/dist/sd-core-common/src/utils/SdSyncEventEmitter.mjs +27 -0
  120. package/dist/sd-core-common/src/utils/StringUtil.d.ts +8 -0
  121. package/dist/sd-core-common/src/utils/StringUtil.js.map +1 -0
  122. package/dist/sd-core-common/src/utils/StringUtil.mjs +77 -0
  123. package/dist/sd-core-common/src/utils/Wait.d.ts +4 -0
  124. package/dist/sd-core-common/src/utils/Wait.js.map +1 -0
  125. package/dist/sd-core-common/src/utils/Wait.mjs +23 -0
  126. package/dist/sd-core-node/src/index.d.ts +6 -0
  127. package/dist/sd-core-node/src/index.js.map +1 -0
  128. package/dist/sd-core-node/src/index.mjs +7 -0
  129. package/dist/sd-core-node/src/utils/FsUtil.d.ts +44 -0
  130. package/dist/sd-core-node/src/utils/FsUtil.js.map +1 -0
  131. package/dist/sd-core-node/src/utils/FsUtil.mjs +493 -0
  132. package/dist/sd-core-node/src/utils/Logger.d.ts +91 -0
  133. package/dist/sd-core-node/src/utils/Logger.js.map +1 -0
  134. package/dist/sd-core-node/src/utils/Logger.mjs +185 -0
  135. package/dist/sd-core-node/src/utils/PathUtil.d.ts +6 -0
  136. package/dist/sd-core-node/src/utils/PathUtil.js.map +1 -0
  137. package/dist/sd-core-node/src/utils/PathUtil.mjs +24 -0
  138. package/dist/sd-core-node/src/utils/SdFsWatcher.d.ts +15 -0
  139. package/dist/sd-core-node/src/utils/SdFsWatcher.js.map +1 -0
  140. package/dist/sd-core-node/src/utils/SdFsWatcher.mjs +43 -0
  141. package/dist/sd-core-node/src/utils/SdProcess.d.ts +5 -0
  142. package/dist/sd-core-node/src/utils/SdProcess.js.map +1 -0
  143. package/dist/sd-core-node/src/utils/SdProcess.mjs +36 -0
  144. package/dist/sd-orm-common/src/CaseQueryHelper.d.ts +12 -0
  145. package/dist/sd-orm-common/src/CaseQueryHelper.js.map +1 -0
  146. package/dist/sd-orm-common/src/CaseQueryHelper.mjs +19 -0
  147. package/dist/sd-orm-common/src/CaseWhenQueryHelper.d.ts +12 -0
  148. package/dist/sd-orm-common/src/CaseWhenQueryHelper.js.map +1 -0
  149. package/dist/sd-orm-common/src/CaseWhenQueryHelper.mjs +20 -0
  150. package/dist/sd-orm-common/src/DbContext.d.ts +81 -0
  151. package/dist/sd-orm-common/src/DbContext.js.map +1 -0
  152. package/dist/sd-orm-common/src/DbContext.mjs +635 -0
  153. package/dist/sd-orm-common/src/IDbConnection.d.ts +15 -0
  154. package/dist/sd-orm-common/src/IDbConnection.js.map +1 -0
  155. package/dist/sd-orm-common/src/IDbConnection.mjs +2 -0
  156. package/dist/sd-orm-common/src/IDbContextExecutor.d.ts +17 -0
  157. package/dist/sd-orm-common/src/IDbContextExecutor.js.map +1 -0
  158. package/dist/sd-orm-common/src/IDbContextExecutor.mjs +2 -0
  159. package/dist/sd-orm-common/src/IDbMigration.d.ts +4 -0
  160. package/dist/sd-orm-common/src/IDbMigration.js.map +1 -0
  161. package/dist/sd-orm-common/src/IDbMigration.mjs +2 -0
  162. package/dist/sd-orm-common/src/QueryBuilder.d.ts +48 -0
  163. package/dist/sd-orm-common/src/QueryBuilder.js.map +1 -0
  164. package/dist/sd-orm-common/src/QueryBuilder.mjs +1022 -0
  165. package/dist/sd-orm-common/src/QueryHelper.d.ts +75 -0
  166. package/dist/sd-orm-common/src/QueryHelper.js.map +1 -0
  167. package/dist/sd-orm-common/src/QueryHelper.mjs +627 -0
  168. package/dist/sd-orm-common/src/QueryUnit.d.ts +10 -0
  169. package/dist/sd-orm-common/src/QueryUnit.js.map +1 -0
  170. package/dist/sd-orm-common/src/QueryUnit.mjs +16 -0
  171. package/dist/sd-orm-common/src/Queryable.d.ts +105 -0
  172. package/dist/sd-orm-common/src/Queryable.js.map +1 -0
  173. package/dist/sd-orm-common/src/Queryable.mjs +1375 -0
  174. package/dist/sd-orm-common/src/SdOrmDataType.d.ts +21 -0
  175. package/dist/sd-orm-common/src/SdOrmDataType.js.map +1 -0
  176. package/dist/sd-orm-common/src/SdOrmDataType.mjs +2 -0
  177. package/dist/sd-orm-common/src/commons.d.ts +400 -0
  178. package/dist/sd-orm-common/src/commons.js.map +1 -0
  179. package/dist/sd-orm-common/src/commons.mjs +8 -0
  180. package/dist/sd-orm-common/src/decorators.d.ts +29 -0
  181. package/dist/sd-orm-common/src/decorators.js.map +1 -0
  182. package/dist/sd-orm-common/src/decorators.mjs +89 -0
  183. package/dist/sd-orm-common/src/index.d.ts +17 -0
  184. package/dist/sd-orm-common/src/index.js.map +1 -0
  185. package/dist/sd-orm-common/src/index.mjs +18 -0
  186. package/dist/sd-orm-common/src/models/SystemMigration.d.ts +3 -0
  187. package/dist/sd-orm-common/src/models/SystemMigration.js.map +1 -0
  188. package/dist/sd-orm-common/src/models/SystemMigration.mjs +13 -0
  189. package/dist/sd-orm-common/src/utils/DbDefinitionUtil.d.ts +14 -0
  190. package/dist/sd-orm-common/src/utils/DbDefinitionUtil.js.map +1 -0
  191. package/dist/sd-orm-common/src/utils/DbDefinitionUtil.mjs +66 -0
  192. package/dist/sd-orm-common/src/utils/SdOrmUtil.d.ts +8 -0
  193. package/dist/sd-orm-common/src/utils/SdOrmUtil.js.map +1 -0
  194. package/dist/sd-orm-common/src/utils/SdOrmUtil.mjs +248 -0
  195. package/dist/sd-orm-node/src/DbConnectionFactory.d.ts +4 -0
  196. package/dist/sd-orm-node/src/DbConnectionFactory.js.map +1 -0
  197. package/dist/sd-orm-node/src/DbConnectionFactory.mjs +17 -0
  198. package/dist/sd-orm-node/src/NodeDbContextExecutor.d.ts +19 -0
  199. package/dist/sd-orm-node/src/NodeDbContextExecutor.js.map +1 -0
  200. package/dist/sd-orm-node/src/NodeDbContextExecutor.mjs +71 -0
  201. package/dist/sd-orm-node/src/SdOrm.d.ts +10 -0
  202. package/dist/sd-orm-node/src/SdOrm.js.map +1 -0
  203. package/dist/sd-orm-node/src/SdOrm.mjs +25 -0
  204. package/dist/sd-orm-node/src/index.d.ts +4 -0
  205. package/dist/sd-orm-node/src/index.js.map +1 -0
  206. package/dist/sd-orm-node/src/index.mjs +5 -0
  207. package/dist/sd-orm-node-mssql/src/MssqlDbConnection.d.ts +25 -0
  208. package/dist/sd-orm-node-mssql/src/MssqlDbConnection.js.map +1 -0
  209. package/dist/sd-orm-node-mssql/src/MssqlDbConnection.mjs +321 -0
  210. package/dist/sd-orm-node-mssql/src/index.d.ts +2 -0
  211. package/dist/sd-orm-node-mssql/src/index.js.map +1 -0
  212. package/dist/sd-orm-node-mssql/src/index.mjs +3 -0
  213. package/dist/sd-orm-node-mysql/src/MysqlDbConnection.d.ts +22 -0
  214. package/dist/sd-orm-node-mysql/src/MysqlDbConnection.js.map +1 -0
  215. package/dist/sd-orm-node-mysql/src/MysqlDbConnection.mjs +200 -0
  216. package/dist/sd-orm-node-mysql/src/index.d.ts +2 -0
  217. package/dist/sd-orm-node-mysql/src/index.js.map +1 -0
  218. package/dist/sd-orm-node-mysql/src/index.mjs +3 -0
  219. package/dist/sd-orm-node-sqlite/src/SqliteDbConnection.d.ts +22 -0
  220. package/dist/sd-orm-node-sqlite/src/SqliteDbConnection.js.map +1 -0
  221. package/dist/sd-orm-node-sqlite/src/SqliteDbConnection.mjs +172 -0
  222. package/dist/sd-orm-node-sqlite/src/index.d.ts +2 -0
  223. package/dist/sd-orm-node-sqlite/src/index.js.map +1 -0
  224. package/dist/sd-orm-node-sqlite/src/index.mjs +3 -0
  225. package/dist/sd-service-common/src/commons-orm.d.ts +4 -0
  226. package/dist/sd-service-common/src/commons-orm.js.map +1 -0
  227. package/dist/sd-service-common/src/commons-orm.mjs +2 -0
  228. package/dist/sd-service-common/src/commons-smtp.d.ts +29 -0
  229. package/dist/sd-service-common/src/commons-smtp.js.map +1 -0
  230. package/dist/sd-service-common/src/commons-smtp.mjs +2 -0
  231. package/dist/sd-service-common/src/commons.d.ts +57 -0
  232. package/dist/sd-service-common/src/commons.js.map +1 -0
  233. package/dist/sd-service-common/src/commons.mjs +3 -0
  234. package/dist/sd-service-common/src/index.d.ts +3 -0
  235. package/dist/sd-service-common/src/index.js.map +1 -0
  236. package/dist/sd-service-common/src/index.mjs +4 -0
  237. package/dist/sd-service-server/src/ApiServiceError.d.ts +12 -0
  238. package/dist/sd-service-server/src/ApiServiceError.js.map +1 -0
  239. package/dist/sd-service-server/src/ApiServiceError.mjs +15 -0
  240. package/dist/sd-service-server/src/SdServiceServer.d.ts +39 -0
  241. package/dist/sd-service-server/src/SdServiceServer.js.map +1 -0
  242. package/dist/sd-service-server/src/SdServiceServer.mjs +513 -0
  243. package/dist/sd-service-server/src/commons.d.ts +23 -0
  244. package/dist/sd-service-server/src/commons.js.map +1 -0
  245. package/dist/sd-service-server/src/commons.mjs +3 -0
  246. package/dist/sd-service-server/src/index.d.ts +8 -0
  247. package/dist/sd-service-server/src/index.js.map +1 -0
  248. package/dist/sd-service-server/src/index.mjs +9 -0
  249. package/dist/sd-service-server/src/services/SdAutoUpdateService.d.ts +4 -0
  250. package/dist/sd-service-server/src/services/SdAutoUpdateService.js.map +1 -0
  251. package/dist/sd-service-server/src/services/SdAutoUpdateService.mjs +20 -0
  252. package/dist/sd-service-server/src/services/SdCryptoService.d.ts +7 -0
  253. package/dist/sd-service-server/src/services/SdCryptoService.js.map +1 -0
  254. package/dist/sd-service-server/src/services/SdCryptoService.mjs +39 -0
  255. package/dist/sd-service-server/src/services/SdOrmService.d.ts +22 -0
  256. package/dist/sd-service-server/src/services/SdOrmService.js.map +1 -0
  257. package/dist/sd-service-server/src/services/SdOrmService.mjs +115 -0
  258. package/dist/sd-service-server/src/services/SdSmtpClientService.d.ts +6 -0
  259. package/dist/sd-service-server/src/services/SdSmtpClientService.js.map +1 -0
  260. package/dist/sd-service-server/src/services/SdSmtpClientService.mjs +44 -0
  261. package/dist/sd-service-server/src/utils/SdServiceServerConfigUtil.d.ts +4 -0
  262. package/dist/sd-service-server/src/utils/SdServiceServerConfigUtil.js.map +1 -0
  263. package/dist/sd-service-server/src/utils/SdServiceServerConfigUtil.mjs +36 -0
  264. package/dist/server-worker.d.ts +1 -0
  265. package/dist/server-worker.js.map +1 -0
  266. package/dist/server-worker.mjs +36 -0
  267. package/dist/utils/SdCliBuildResultUtil.d.ts +1 -4
  268. package/dist/utils/SdCliBuildResultUtil.js.map +1 -0
  269. package/dist/utils/SdCliBuildResultUtil.mjs +3 -29
  270. package/dist/utils/SdCliConfigUtil.js.map +1 -0
  271. package/dist/utils/SdCliConfigUtil.mjs +1 -1
  272. package/package.json +14 -56
  273. package/src/SdLinter.ts +41 -0
  274. package/src/SdTsIncrementalBuilder.ts +75 -0
  275. package/src/build-cluster.ts +133 -0
  276. package/src/builders/SdCliClientBuilder.ts +189 -0
  277. package/src/builders/SdCliJsLibLinter.ts +72 -0
  278. package/src/builders/SdCliServerBuilder.ts +191 -0
  279. package/src/builders/SdCliTsLibBuilder.ts +96 -0
  280. package/src/commons.ts +21 -112
  281. package/src/entry/SdCliProject.ts +467 -0
  282. package/src/sd-cli.ts +136 -0
  283. package/src/server-worker.ts +45 -0
  284. package/src/utils/SdCliBuildResultUtil.ts +5 -38
  285. package/tsconfig.json +9 -0
  286. package/README.md +0 -105
  287. package/assets/client-files/assets/icons/icon-128x128.png +0 -0
  288. package/assets/client-files/assets/icons/icon-144x144.png +0 -0
  289. package/assets/client-files/assets/icons/icon-152x152.png +0 -0
  290. package/assets/client-files/assets/icons/icon-192x192.png +0 -0
  291. package/assets/client-files/assets/icons/icon-384x384.png +0 -0
  292. package/assets/client-files/assets/icons/icon-512x512.png +0 -0
  293. package/assets/client-files/assets/icons/icon-72x72.png +0 -0
  294. package/assets/client-files/assets/icons/icon-96x96.png +0 -0
  295. package/assets/client-files/favicon.ico +0 -0
  296. package/dist/SdCliBuildResultError.d.ts +0 -5
  297. package/dist/SdCliBuildResultError.mjs +0 -8
  298. package/dist/bin/sd-cli.d.ts +0 -2
  299. package/dist/bin/sd-cli.mjs +0 -410
  300. package/dist/build-tool/SdCliCacheCompilerHost.d.ts +0 -10
  301. package/dist/build-tool/SdCliCacheCompilerHost.mjs +0 -51
  302. package/dist/build-tool/SdCliCordova.d.ts +0 -16
  303. package/dist/build-tool/SdCliCordova.mjs +0 -212
  304. package/dist/build-tool/SdCliElectron.d.ts +0 -9
  305. package/dist/build-tool/SdCliElectron.mjs +0 -72
  306. package/dist/build-tool/SdCliGithubApi.d.ts +0 -13
  307. package/dist/build-tool/SdCliGithubApi.mjs +0 -92
  308. package/dist/build-tool/SdCliIndexFileGenerator.d.ts +0 -13
  309. package/dist/build-tool/SdCliIndexFileGenerator.mjs +0 -62
  310. package/dist/build-tool/SdCliNgCacheCompilerHost.d.ts +0 -12
  311. package/dist/build-tool/SdCliNgCacheCompilerHost.mjs +0 -43
  312. package/dist/build-tool/SdCliPackageLinter.d.ts +0 -8
  313. package/dist/build-tool/SdCliPackageLinter.mjs +0 -62
  314. package/dist/builder/SdCliClientBuilder.d.ts +0 -26
  315. package/dist/builder/SdCliClientBuilder.mjs +0 -769
  316. package/dist/builder/SdCliJsLibBuilder.d.ts +0 -14
  317. package/dist/builder/SdCliJsLibBuilder.mjs +0 -54
  318. package/dist/builder/SdCliServerBuilder.d.ts +0 -28
  319. package/dist/builder/SdCliServerBuilder.mjs +0 -482
  320. package/dist/builder/SdCliTsLibBuilder.d.ts +0 -35
  321. package/dist/builder/SdCliTsLibBuilder.mjs +0 -317
  322. package/dist/entry-points/SdCliFileCrypto.d.ts +0 -7
  323. package/dist/entry-points/SdCliFileCrypto.mjs +0 -72
  324. package/dist/entry-points/SdCliLocalUpdate.d.ts +0 -13
  325. package/dist/entry-points/SdCliLocalUpdate.mjs +0 -100
  326. package/dist/entry-points/SdCliPrepare.d.ts +0 -5
  327. package/dist/entry-points/SdCliPrepare.mjs +0 -86
  328. package/dist/entry-points/SdCliProject.d.ts +0 -34
  329. package/dist/entry-points/SdCliProject.mjs +0 -416
  330. package/dist/entry-points/SdCliProjectGenerator.d.ts +0 -44
  331. package/dist/entry-points/SdCliProjectGenerator.mjs +0 -326
  332. package/dist/entry-points/file/base/fc_package_eslintrc.d.ts +0 -3
  333. package/dist/entry-points/file/base/fc_package_eslintrc.mjs +0 -31
  334. package/dist/entry-points/file/base/fc_package_npmconfig.d.ts +0 -9
  335. package/dist/entry-points/file/base/fc_package_npmconfig.mjs +0 -32
  336. package/dist/entry-points/file/base/fc_package_tsconfig.d.ts +0 -5
  337. package/dist/entry-points/file/base/fc_package_tsconfig.mjs +0 -13
  338. package/dist/entry-points/file/client/fc_package_AppModule.d.ts +0 -1
  339. package/dist/entry-points/file/client/fc_package_AppModule.mjs +0 -37
  340. package/dist/entry-points/file/client/fc_package_AppPage.d.ts +0 -1
  341. package/dist/entry-points/file/client/fc_package_AppPage.mjs +0 -14
  342. package/dist/entry-points/file/client/fc_package_Page.d.ts +0 -4
  343. package/dist/entry-points/file/client/fc_package_Page.mjs +0 -19
  344. package/dist/entry-points/file/client/fc_package_client_main.d.ts +0 -1
  345. package/dist/entry-points/file/client/fc_package_client_main.mjs +0 -19
  346. package/dist/entry-points/file/client/fc_package_index.d.ts +0 -3
  347. package/dist/entry-points/file/client/fc_package_index.mjs +0 -88
  348. package/dist/entry-points/file/client/fc_package_manifest.d.ts +0 -5
  349. package/dist/entry-points/file/client/fc_package_manifest.mjs +0 -54
  350. package/dist/entry-points/file/client/fc_package_polyfills.d.ts +0 -1
  351. package/dist/entry-points/file/client/fc_package_polyfills.mjs +0 -11
  352. package/dist/entry-points/file/client/fc_package_styles.d.ts +0 -1
  353. package/dist/entry-points/file/client/fc_package_styles.mjs +0 -7
  354. package/dist/entry-points/file/db/fc_package_DbContext.d.ts +0 -3
  355. package/dist/entry-points/file/db/fc_package_DbContext.mjs +0 -14
  356. package/dist/entry-points/file/db/fc_package_DbModel.d.ts +0 -4
  357. package/dist/entry-points/file/db/fc_package_DbModel.mjs +0 -12
  358. package/dist/entry-points/file/project/fc_project_editor_config.d.ts +0 -1
  359. package/dist/entry-points/file/project/fc_project_editor_config.mjs +0 -22
  360. package/dist/entry-points/file/project/fc_project_eslintrc.d.ts +0 -1
  361. package/dist/entry-points/file/project/fc_project_eslintrc.mjs +0 -30
  362. package/dist/entry-points/file/project/fc_project_gitattributes.d.ts +0 -1
  363. package/dist/entry-points/file/project/fc_project_gitattributes.mjs +0 -6
  364. package/dist/entry-points/file/project/fc_project_gitignore.d.ts +0 -1
  365. package/dist/entry-points/file/project/fc_project_gitignore.mjs +0 -27
  366. package/dist/entry-points/file/project/fc_project_npmconfig.d.ts +0 -7
  367. package/dist/entry-points/file/project/fc_project_npmconfig.mjs +0 -37
  368. package/dist/entry-points/file/project/fc_project_readme.d.ts +0 -3
  369. package/dist/entry-points/file/project/fc_project_readme.mjs +0 -13
  370. package/dist/entry-points/file/project/fc_project_simplysm.d.ts +0 -1
  371. package/dist/entry-points/file/project/fc_project_simplysm.mjs +0 -2
  372. package/dist/entry-points/file/project/fc_project_tsconfig.d.ts +0 -1
  373. package/dist/entry-points/file/project/fc_project_tsconfig.mjs +0 -25
  374. package/dist/entry-points/file/server/fc_package_server_main.d.ts +0 -5
  375. package/dist/entry-points/file/server/fc_package_server_main.mjs +0 -60
  376. package/dist/index.d.ts +0 -54
  377. package/dist/index.mjs +0 -55
  378. package/dist/ng-tools/SdCliNgModuleGenerator.d.ts +0 -29
  379. package/dist/ng-tools/SdCliNgModuleGenerator.mjs +0 -502
  380. package/dist/ng-tools/babel/SdCliBbFileMetadata.d.ts +0 -25
  381. package/dist/ng-tools/babel/SdCliBbFileMetadata.mjs +0 -539
  382. package/dist/ng-tools/babel/SdCliBbRootMetadata.d.ts +0 -23
  383. package/dist/ng-tools/babel/SdCliBbRootMetadata.mjs +0 -247
  384. package/dist/ng-tools/babel/SdCliBbUtil.d.ts +0 -5
  385. package/dist/ng-tools/babel/SdCliBbUtil.mjs +0 -14
  386. package/dist/ng-tools/babel/TSdCliBbNgMetadata.d.ts +0 -42
  387. package/dist/ng-tools/babel/TSdCliBbNgMetadata.mjs +0 -216
  388. package/dist/ng-tools/babel/TSdCliBbTypeMetadata.d.ts +0 -55
  389. package/dist/ng-tools/babel/TSdCliBbTypeMetadata.mjs +0 -151
  390. package/dist/ng-tools/commons.d.ts +0 -9
  391. package/dist/ng-tools/commons.mjs +0 -2
  392. package/dist/ng-tools/typescript/SdCliTsFileMetadata.d.ts +0 -61
  393. package/dist/ng-tools/typescript/SdCliTsFileMetadata.mjs +0 -325
  394. package/dist/ng-tools/typescript/SdCliTsRootMetadata.d.ts +0 -8
  395. package/dist/ng-tools/typescript/SdCliTsRootMetadata.mjs +0 -28
  396. package/dist/ng-tools/typescript/SdCliTsUtil.d.ts +0 -5
  397. package/dist/ng-tools/typescript/SdCliTsUtil.mjs +0 -28
  398. package/dist/packages/SdCliPackage.d.ts +0 -22
  399. package/dist/packages/SdCliPackage.mjs +0 -206
  400. package/dist/utils/SdCliNpmConfigUtil.d.ts +0 -7
  401. package/dist/utils/SdCliNpmConfigUtil.mjs +0 -15
  402. package/dist/worker/build-worker.mjs +0 -67
  403. package/dist/worker/server-worker.mjs +0 -67
  404. package/docs/client-add-page.md +0 -8
  405. package/docs/client-router.md +0 -85
  406. package/docs/client-sw.md +0 -101
  407. package/docs/conf-orm.md +0 -81
  408. package/docs/conf-usage.md +0 -5
  409. package/docs/lib-local-update.md +0 -50
  410. package/docs/lib-ts-paths.md +0 -25
  411. package/lib/cordova-entry.js +0 -22
  412. package/src/SdCliBuildResultError.ts +0 -9
  413. package/src/bin/sd-cli.ts +0 -493
  414. package/src/build-tool/SdCliCacheCompilerHost.ts +0 -79
  415. package/src/build-tool/SdCliCordova.ts +0 -263
  416. package/src/build-tool/SdCliElectron.ts +0 -85
  417. package/src/build-tool/SdCliGithubApi.ts +0 -111
  418. package/src/build-tool/SdCliIndexFileGenerator.ts +0 -79
  419. package/src/build-tool/SdCliNgCacheCompilerHost.ts +0 -58
  420. package/src/build-tool/SdCliPackageLinter.ts +0 -74
  421. package/src/builder/SdCliClientBuilder.ts +0 -879
  422. package/src/builder/SdCliJsLibBuilder.ts +0 -70
  423. package/src/builder/SdCliServerBuilder.ts +0 -552
  424. package/src/builder/SdCliTsLibBuilder.ts +0 -450
  425. package/src/entry-points/SdCliFileCrypto.ts +0 -87
  426. package/src/entry-points/SdCliLocalUpdate.ts +0 -121
  427. package/src/entry-points/SdCliPrepare.ts +0 -86
  428. package/src/entry-points/SdCliProject.ts +0 -491
  429. package/src/entry-points/SdCliProjectGenerator.ts +0 -402
  430. package/src/entry-points/file/base/fc_package_eslintrc.ts +0 -30
  431. package/src/entry-points/file/base/fc_package_npmconfig.ts +0 -43
  432. package/src/entry-points/file/base/fc_package_tsconfig.ts +0 -12
  433. package/src/entry-points/file/client/fc_package_AppModule.ts +0 -36
  434. package/src/entry-points/file/client/fc_package_AppPage.ts +0 -13
  435. package/src/entry-points/file/client/fc_package_Page.ts +0 -19
  436. package/src/entry-points/file/client/fc_package_client_main.ts +0 -18
  437. package/src/entry-points/file/client/fc_package_index.ts +0 -87
  438. package/src/entry-points/file/client/fc_package_manifest.ts +0 -53
  439. package/src/entry-points/file/client/fc_package_polyfills.ts +0 -10
  440. package/src/entry-points/file/client/fc_package_styles.ts +0 -6
  441. package/src/entry-points/file/db/fc_package_DbContext.ts +0 -14
  442. package/src/entry-points/file/db/fc_package_DbModel.ts +0 -11
  443. package/src/entry-points/file/project/fc_project_editor_config.ts +0 -21
  444. package/src/entry-points/file/project/fc_project_eslintrc.ts +0 -29
  445. package/src/entry-points/file/project/fc_project_gitattributes.ts +0 -5
  446. package/src/entry-points/file/project/fc_project_gitignore.ts +0 -26
  447. package/src/entry-points/file/project/fc_project_npmconfig.ts +0 -36
  448. package/src/entry-points/file/project/fc_project_readme.ts +0 -12
  449. package/src/entry-points/file/project/fc_project_simplysm.ts +0 -1
  450. package/src/entry-points/file/project/fc_project_tsconfig.ts +0 -24
  451. package/src/entry-points/file/server/fc_package_server_main.ts +0 -62
  452. package/src/index.ts +0 -54
  453. package/src/ng-tools/SdCliNgModuleGenerator.ts +0 -672
  454. package/src/ng-tools/babel/SdCliBbFileMetadata.ts +0 -629
  455. package/src/ng-tools/babel/SdCliBbRootMetadata.ts +0 -292
  456. package/src/ng-tools/babel/SdCliBbUtil.ts +0 -15
  457. package/src/ng-tools/babel/TSdCliBbNgMetadata.ts +0 -251
  458. package/src/ng-tools/babel/TSdCliBbTypeMetadata.ts +0 -212
  459. package/src/ng-tools/commons.ts +0 -3
  460. package/src/ng-tools/typescript/SdCliTsFileMetadata.ts +0 -384
  461. package/src/ng-tools/typescript/SdCliTsRootMetadata.ts +0 -32
  462. package/src/ng-tools/typescript/SdCliTsUtil.ts +0 -29
  463. package/src/packages/SdCliPackage.ts +0 -259
  464. package/src/utils/SdCliNpmConfigUtil.ts +0 -16
  465. package/src/worker/build-worker.ts +0 -73
  466. package/src/worker/server-worker.ts +0 -72
  467. /package/dist/{worker/build-worker.d.ts → build-cluster.d.ts} +0 -0
  468. /package/dist/{worker/server-worker.d.ts → sd-cli.d.ts} +0 -0
@@ -1,672 +0,0 @@
1
- import { SdCliTsRootMetadata } from "./typescript/SdCliTsRootMetadata";
2
- import { SdCliBbRootMetadata, TSdCliBbMetadata } from "./babel/SdCliBbRootMetadata";
3
- import {
4
- SdCliBbArrayMetadata,
5
- SdCliBbClassMetadata,
6
- SdCliBbConditionMetadata,
7
- SdCliBbObjectMetadata
8
- } from "./babel/TSdCliBbTypeMetadata";
9
- import {
10
- SdCliBbNgComponentMetadata,
11
- SdCliBbNgDirectiveMetadata,
12
- SdCliBbNgModuleMetadata,
13
- SdCliBbNgPipeMetadata
14
- } from "./babel/TSdCliBbNgMetadata";
15
- import { NeverEntryError, ObjectUtil, StringUtil } from "@simplysm/sd-core-common";
16
- import { TSdCliMetaRef } from "./commons";
17
- import { SdCliTsNgInjectableMetadata } from "./typescript/SdCliTsFileMetadata";
18
- import path from "path";
19
- import { JSDOM } from "jsdom";
20
- import { FsUtil, Logger, PathUtil } from "@simplysm/sd-core-node";
21
- import { INpmConfig } from "../commons";
22
-
23
- export class SdCliNgModuleGenerator {
24
- private readonly _logger: Logger;
25
-
26
- private readonly _bbMeta: SdCliBbRootMetadata;
27
- private readonly _tsMeta: SdCliTsRootMetadata;
28
-
29
- private readonly _srcPath: string;
30
- private readonly _modulesPath: string;
31
-
32
- private readonly _fileWriterCache = new Map<string, string>();
33
-
34
- public constructor(packagePath: string,
35
- private readonly _srcDirRelPaths: string[],
36
- private readonly _routeOpts: {
37
- glob: string;
38
- fileEndsWith: string;
39
- rootClassName: string;
40
- } | undefined) {
41
- this._srcPath = path.resolve(packagePath, "src");
42
- this._modulesPath = path.resolve(packagePath, "src", "_modules");
43
-
44
- this._bbMeta = new SdCliBbRootMetadata(packagePath);
45
- this._tsMeta = new SdCliTsRootMetadata(packagePath);
46
-
47
- const glob = FsUtil.glob(path.resolve(this._modulesPath, "**", "*.ts"));
48
- for (const currFilePath of glob) {
49
- const content = FsUtil.readFile(currFilePath);
50
- this._fileWriterCache.set(currFilePath, content);
51
- }
52
-
53
- const npmConfig: INpmConfig = FsUtil.readJson(path.resolve(packagePath, "package.json"));
54
- this._logger = Logger.get(["simplysm", "sd-cli", this.constructor.name, npmConfig.name]);
55
- }
56
-
57
- public removeCaches(changedFilePaths: string[]): void {
58
- this._bbMeta.removeCaches(changedFilePaths);
59
- this._tsMeta.removeCaches(changedFilePaths);
60
- for (const changedFilePath of changedFilePaths) {
61
- if (this._fileWriterCache.has(changedFilePath) && !FsUtil.exists(changedFilePath)) {
62
- this._fileWriterCache.delete(changedFilePath);
63
- }
64
- }
65
- }
66
-
67
- public async runAsync(): Promise<void> {
68
- this._logger.debug("Babel NgModule 정의 가져오기...");
69
- const bbNgModules = this._getBbNgModuleDefs();
70
-
71
- this._logger.debug("NgModule Preset 구성...");
72
- const tsPreset = this._getTsGenNgModulePreset();
73
-
74
- this._logger.debug("RoutingModule 정의 구성...");
75
- const genNgRoutingModules = await this._getGenNgRoutingModuleDefsAsync();
76
-
77
- this._logger.debug("NgModule 정의 구성...");
78
- const genNgModules = this._getGenNgModuleDefs(bbNgModules, tsPreset.modules, tsPreset.sources);
79
-
80
- this._logger.debug("NgModule 순환참조 병합...");
81
- const mergedGenNgModules = this._mergeNgModuleCircularDependency(genNgModules);
82
-
83
- this._logger.debug("생성할 파일 내용 구성...");
84
- const files = [
85
- ...this._getGenNgRoutingModuleFiles(genNgRoutingModules),
86
- ...this._getGenNgModuleFiles(mergedGenNgModules)
87
- ];
88
-
89
- this._logger.debug("파일 쓰기...");
90
- await this._writeFilesAsync(files);
91
- }
92
-
93
- private _mergeNgModuleCircularDependency(mods: ITsGenNgModuleDef[]): ITsGenNgModuleDef[] {
94
- // 중복 'check'목록 구성
95
- const check = (mod: ITsGenNgModuleDef, ref: { filePath: string; name: string }, chain: ITsGenNgModuleDef[]): ITsGenNgModuleDef[][] => {
96
- const result: ITsGenNgModuleDef[][] = [];
97
- for (const imp of mod.imports) {
98
- if ("filePath" in imp) {
99
- if (imp.filePath === ref.filePath || imp.name === ref.name) {
100
- result.push(chain.concat([mod]));
101
- }
102
- else {
103
- const childMod = mods.single((item) => item.filePath === imp.filePath && item.name === imp.name);
104
- if (childMod) {
105
- if (chain.some((item) => item.filePath === childMod.filePath && item.name === childMod.name)) {
106
- continue;
107
- }
108
-
109
- result.push(
110
- ...check(childMod, ref, chain.concat([mod]))
111
- );
112
- }
113
- }
114
- }
115
- }
116
-
117
- return result;
118
- };
119
-
120
- const checkedList: ITsGenNgModuleDef[][] = [];
121
- for (const mod of mods) {
122
- const circularDepModules = check(mod, { filePath: mod.filePath, name: mod.name }, []);
123
- if (circularDepModules.length > 0) {
124
- checkedList.push(...circularDepModules);
125
- }
126
- }
127
- const mergeModPacks = checkedList.map((item) => item.orderBy((item1) => item1.filePath)).distinct();
128
-
129
- // 'merge'목록 구성
130
- const currMergedList: ITsGenNgModuleDef[] = [];
131
- for (const mergeModPack of mergeModPacks) {
132
- let currMerged = mergeModPack[0];
133
- for (const mergeMod of mergeModPack.slice(1)) {
134
- currMerged = {
135
- filePath: currMerged.filePath,
136
- name: currMerged.name,
137
- imports: currMerged.imports.concat(mergeMod.imports).distinct(),
138
- exports: currMerged.exports.concat(mergeMod.exports).distinct(),
139
- providers: currMerged.providers.concat(mergeMod.providers).distinct()
140
- };
141
- }
142
- currMerged.imports.remove((imp) => (
143
- "filePath" in imp &&
144
- mergeModPack.some((mergeMod) => (
145
- imp.filePath === mergeMod.filePath &&
146
- imp.name === mergeMod.name
147
- ))
148
- ));
149
-
150
- currMergedList.push(currMerged);
151
- }
152
-
153
- // 기존 'check'된 것들 모두 삭제
154
- const result: ITsGenNgModuleDef[] = ObjectUtil.clone(mods);
155
- for (const delMod of mergeModPacks.mapMany()) {
156
- result.remove((item) => item.filePath === delMod.filePath && item.name === delMod.name);
157
- }
158
-
159
- // 'merge'된 것들 등록
160
- result.push(...currMergedList);
161
-
162
- // 모든 결과물에서 'import'에 'merge'된것들이 있으면 'merge'결과물 파일로 변경후, distinct
163
- for (const resultItem of result) {
164
- for (const imp of resultItem.imports) {
165
- if (!("filePath" in imp)) continue;
166
-
167
- for (const mergeModPack of mergeModPacks) {
168
- if (mergeModPack.some((mergeModPackItem) => mergeModPackItem.filePath === imp.filePath && mergeModPackItem.name === imp.name)) {
169
- imp.filePath = mergeModPack[0].filePath;
170
- imp.name = mergeModPack[0].name;
171
- }
172
- }
173
- }
174
- resultItem.imports = resultItem.imports.distinct();
175
- }
176
-
177
- return result;
178
- }
179
-
180
- private _findBbMetasFromMeta(srcMeta: TSdCliBbMetadata): TSdCliBbMetadata[] {
181
- const metaTmp = typeof srcMeta !== "string" && "__TSdCliMetaRef__" in srcMeta ? this._bbMeta.findMeta(srcMeta) : srcMeta;
182
- return metaTmp instanceof Array ? metaTmp : [metaTmp];
183
- }
184
-
185
- private _getBbNgModuleProvClass(modProvMeta: TSdCliBbMetadata): { moduleName: string; name: string }[] {
186
- const result: { moduleName: string; name: string }[] = [];
187
-
188
- if (modProvMeta instanceof SdCliBbObjectMetadata) {
189
- // 무시
190
- }
191
- else if (modProvMeta instanceof SdCliBbClassMetadata) {
192
- const ref = this._bbMeta.findExportRef({
193
- filePath: modProvMeta.filePath,
194
- name: modProvMeta.name
195
- });
196
- if (ref) {
197
- result.push(ref);
198
- }
199
- }
200
- else if (modProvMeta instanceof SdCliBbConditionMetadata) {
201
- if (modProvMeta.consequent !== undefined) {
202
- result.push(
203
- ...this._getBbNgModuleProvClass(modProvMeta.consequent)
204
- );
205
- }
206
-
207
- if (modProvMeta.alternate !== undefined) {
208
- result.push(
209
- ...this._getBbNgModuleProvClass(modProvMeta.alternate)
210
- );
211
- }
212
- }
213
- else if (modProvMeta instanceof SdCliBbArrayMetadata) {
214
- for (const modProvMetaValue of modProvMeta.value) {
215
- if (modProvMetaValue !== undefined) {
216
- result.push(...this._getBbNgModuleProvClass(modProvMetaValue));
217
- }
218
- }
219
- }
220
- else {
221
- throw new NeverEntryError();
222
- }
223
-
224
- return result;
225
- }
226
-
227
- private _getBbNgModuleDefs(): IBbNgModuleDef[] {
228
- const entryRecord = this._bbMeta.getEntryFileMetaRecord();
229
- const result: IBbNgModuleDef[] = [];
230
-
231
- for (const moduleName of Object.keys(entryRecord)) {
232
- const fileMeta = entryRecord[moduleName];
233
- for (const exp of fileMeta.exports) {
234
- const metas = this._findBbMetasFromMeta(exp.target);
235
-
236
- for (const meta of metas) {
237
- if (meta instanceof SdCliBbClassMetadata) {
238
- if (meta.ngDecl instanceof SdCliBbNgModuleMetadata) {
239
- const ngDecl = meta.ngDecl;
240
-
241
- const resultItem: IBbNgModuleDef = {
242
- moduleName,
243
- name: exp.exportedName === "*" ? meta.name : exp.exportedName,
244
- providers: [],
245
- exports: [],
246
- selectors: [],
247
- pipeNames: []
248
- };
249
-
250
- for (const modProv of ngDecl.def.providers) {
251
- const modProvMetas = this._findBbMetasFromMeta(modProv);
252
- if (modProvMetas.length === 0) {
253
- throw new NeverEntryError();
254
- }
255
-
256
- for (const modProvMeta of modProvMetas) {
257
- resultItem.providers.push(...this._getBbNgModuleProvClass(modProvMeta));
258
- }
259
- }
260
-
261
- for (const modExp of ngDecl.def.exports) {
262
- const modExpMetas = this._findBbMetasFromMeta(modExp);
263
- if (modExpMetas.length === 0) {
264
- throw new NeverEntryError();
265
- }
266
-
267
- for (const modExpMeta of modExpMetas) {
268
- if (modExpMeta instanceof SdCliBbClassMetadata) {
269
- const ref = this._bbMeta.findExportRef({
270
- filePath: modExpMeta.filePath,
271
- name: modExpMeta.name
272
- });
273
- if (ref) {
274
- resultItem.exports.push(ref);
275
- }
276
-
277
- if (modExpMeta.ngDecl instanceof SdCliBbNgDirectiveMetadata) {
278
- resultItem.selectors.push(modExpMeta.ngDecl.selector);
279
- }
280
- else if (modExpMeta.ngDecl instanceof SdCliBbNgComponentMetadata) {
281
- resultItem.selectors.push(modExpMeta.ngDecl.selector);
282
- }
283
- else if (modExpMeta.ngDecl instanceof SdCliBbNgPipeMetadata) {
284
- resultItem.pipeNames.push(modExpMeta.ngDecl.pipeName);
285
- }
286
- }
287
- else {
288
- throw new NeverEntryError();
289
- }
290
- }
291
- }
292
-
293
- result.push(resultItem);
294
- }
295
- }
296
- }
297
- }
298
- }
299
- return result;
300
- }
301
-
302
- private _getTsGenNgModulePreset(): { modules: ITsNgPresetModuleDef[]; sources: ITsNgPresetSourceDef[] } {
303
- const fileMetas = this._tsMeta.getFileMetas();
304
-
305
- const result: { modules: ITsNgPresetModuleDef[]; sources: ITsNgPresetSourceDef[] } = { modules: [], sources: [] };
306
-
307
- for (const fileMeta of fileMetas) {
308
- if (!this._srcDirRelPaths.some((item) => fileMeta.filePath.startsWith(path.resolve(this._srcPath, item)))) {
309
- continue;
310
- }
311
-
312
- for (const cls of fileMeta.directExportClasses) {
313
- if (cls.target.ngDecl) {
314
- if (cls.target.ngDecl instanceof SdCliTsNgInjectableMetadata) {
315
- if (cls.target.ngDecl.providedIn === "root") {
316
- continue;
317
- }
318
- }
319
-
320
- const moduleClassName = cls.exportedName + "Module";
321
- const moduleFilePath = path.resolve(this._modulesPath, path.relative(this._srcPath, path.dirname(fileMeta.filePath)), moduleClassName);
322
-
323
- result.sources.push({
324
- filePath: fileMeta.filePath.replace(/\.[^.]*$/, ""),
325
- name: cls.exportedName,
326
- module: {
327
- filePath: moduleFilePath,
328
- name: moduleClassName
329
- },
330
- imports: fileMeta.imports,
331
- template: "template" in cls.target.ngDecl ? cls.target.ngDecl.template : undefined,
332
- isProvider: cls.target.ngDecl instanceof SdCliTsNgInjectableMetadata
333
- });
334
-
335
- result.modules.push({
336
- filePath: moduleFilePath,
337
- name: moduleClassName,
338
- source: {
339
- filePath: fileMeta.filePath.replace(/\.[^.]*$/, ""),
340
- name: cls.exportedName
341
- },
342
- selector: "selector" in cls.target.ngDecl ? cls.target.ngDecl.selector : undefined,
343
- pipeName: "pipeName" in cls.target.ngDecl ? cls.target.ngDecl.pipeName : undefined
344
- });
345
- }
346
- }
347
- }
348
-
349
- return result;
350
- }
351
-
352
- private _getGenNgModuleDefs(bbModules: IBbNgModuleDef[], presetModules: ITsNgPresetModuleDef[], presetSources: ITsNgPresetSourceDef[]): ITsGenNgModuleDef[] {
353
- const result: ITsGenNgModuleDef[] = [];
354
-
355
- for (const presetSource of presetSources) {
356
- const imports: TSdCliMetaRef[] = [];
357
- for (const imp of presetSource.imports) {
358
- if ("moduleName" in imp) {
359
- for (const mod of bbModules) {
360
- if (mod.exports.some((item) => item.moduleName === imp.moduleName && item.name === imp.name)) {
361
- imports.push({ moduleName: mod.moduleName, name: mod.name, __TSdCliMetaRef__: "__TSdCliMetaRef__" });
362
- }
363
- if (mod.providers.some((item) => item.moduleName === imp.moduleName && item.name === imp.name)) {
364
- imports.push({ moduleName: mod.moduleName, name: mod.name, __TSdCliMetaRef__: "__TSdCliMetaRef__" });
365
- }
366
- }
367
- }
368
- else {
369
- for (const mod of presetModules) {
370
- if (mod.source && mod.source.filePath === imp.filePath && mod.source.name === imp.name) {
371
- imports.push({ filePath: mod.filePath, name: mod.name, __TSdCliMetaRef__: "__TSdCliMetaRef__" });
372
- }
373
- }
374
- }
375
- }
376
-
377
- if (presetSource.template !== undefined) {
378
- const templateDOM = new JSDOM(presetSource.template);
379
-
380
- for (const mod of bbModules) {
381
- for (const selector of mod.selectors) {
382
- if (
383
- templateDOM.window.document.querySelector([
384
- selector,
385
- selector.replace(/\[/g, "[\\[").replace(/]/g, "\\]]"),
386
- selector.replace(/\[/g, "[\\(").replace(/]/g, "\\)]")
387
- ].join(", ")) != null
388
- ) {
389
- imports.push({ moduleName: mod.moduleName, name: mod.name, __TSdCliMetaRef__: "__TSdCliMetaRef__" });
390
- }
391
- }
392
-
393
- for (const pipeName of mod.pipeNames) {
394
- if (new RegExp("| *" + pipeName + "[^\\w]").test(presetSource.template)) {
395
- imports.push({ moduleName: mod.moduleName, name: mod.name, __TSdCliMetaRef__: "__TSdCliMetaRef__" });
396
- }
397
- }
398
- }
399
-
400
- for (const mod of presetModules) {
401
- if (mod.selector !== undefined) {
402
- if (
403
- templateDOM.window.document.querySelector([
404
- mod.selector,
405
- mod.selector.replace(/\[/g, "[\\[").replace(/]/g, "\\]]"),
406
- mod.selector.replace(/\[/g, "[\\(").replace(/]/g, "\\)]")
407
- ].join(", ")) != null
408
- ) {
409
- imports.push({ filePath: mod.filePath, name: mod.name, __TSdCliMetaRef__: "__TSdCliMetaRef__" });
410
- }
411
- }
412
-
413
- if (mod.pipeName !== undefined) {
414
- if (new RegExp("| *" + mod.pipeName + "[^\\w]").test(presetSource.template)) {
415
- imports.push({ filePath: mod.filePath, name: mod.name, __TSdCliMetaRef__: "__TSdCliMetaRef__" });
416
- }
417
- }
418
- }
419
- }
420
-
421
- result.push({
422
- filePath: presetSource.module.filePath,
423
- name: presetSource.module.name,
424
- imports: imports.distinct(),
425
- exports: presetSource.isProvider ? [] : [{ filePath: presetSource.filePath, name: presetSource.name }],
426
- providers: presetSource.isProvider ? [{ filePath: presetSource.filePath, name: presetSource.name }] : []
427
- });
428
- }
429
-
430
- return result;
431
- }
432
-
433
- private async _getGenNgRoutingModuleDefsAsync(): Promise<TTsGenNgRoutingModuleDef[]> {
434
- if (this._routeOpts === undefined) return [];
435
-
436
- const result: TTsGenNgRoutingModuleDef[] = [];
437
-
438
- const filePaths = await FsUtil.globAsync(path.resolve(this._srcPath, this._routeOpts.glob));
439
- for (const filePath of filePaths) {
440
- const sourceClassName = path.basename(filePath, path.extname(filePath));
441
- if (sourceClassName === this._routeOpts.rootClassName) {
442
- const childDirName = StringUtil.toKebabCase(sourceClassName.slice(0, -this._routeOpts.fileEndsWith.length));
443
- const childDirPath = path.resolve(path.dirname(filePath), childDirName);
444
-
445
- result.push({
446
- filePath: path.resolve(this._srcPath, "_routes"),
447
- children: await this._getGenNgRoutingModuleDefChildrenAsync(childDirPath)
448
- });
449
- }
450
- else {
451
- const routingModuleClassName = sourceClassName + "RoutingModule";
452
- const routingModuleFilePath = path.resolve(this._modulesPath, path.relative(this._srcPath, path.dirname(filePath)), routingModuleClassName);
453
- const childDirName = StringUtil.toKebabCase(sourceClassName.slice(0, -this._routeOpts.fileEndsWith.length));
454
- const childDirPath = path.resolve(path.dirname(filePath), childDirName);
455
-
456
- result.push({
457
- filePath: routingModuleFilePath,
458
- name: routingModuleClassName,
459
- component: { filePath: filePath.replace(/\.ts$/, ""), name: sourceClassName },
460
- children: FsUtil.exists(childDirPath) ? await this._getGenNgRoutingModuleDefChildrenAsync(childDirPath) : undefined
461
- });
462
- }
463
- }
464
-
465
- return result;
466
- }
467
-
468
- private async _getGenNgRoutingModuleDefChildrenAsync(rootPath: string): Promise<TTsGenNgRoutingModuleDefChild[]> {
469
- const result: TTsGenNgRoutingModuleDefChild[] = [];
470
-
471
- const childNames = await FsUtil.readdirAsync(rootPath);
472
- for (const childName of childNames) {
473
- if (!FsUtil.stat(path.resolve(rootPath, childName)).isDirectory()) { // 파일
474
- const sourceFilePath = path.resolve(rootPath, childName);
475
- const sourceClassName = path.basename(sourceFilePath, path.extname(childName));
476
- const moduleClassName = sourceClassName + "Module";
477
- const moduleFilePath = path.resolve(this._modulesPath, path.relative(this._srcPath, path.dirname(sourceFilePath)), moduleClassName);
478
-
479
- result.push({
480
- path: StringUtil.toKebabCase(childName.substring(0, childName.length - 7)),
481
- target: { filePath: moduleFilePath, name: moduleClassName }
482
- });
483
- }
484
- else if (!FsUtil.exists(path.resolve(rootPath, StringUtil.toPascalCase(childName) + this._routeOpts!.fileEndsWith + ".ts"))) { // 파일없는 디렉토리
485
- result.push({
486
- path: childName,
487
- children: await this._getGenNgRoutingModuleDefChildrenAsync(path.resolve(rootPath, childName))
488
- });
489
- }
490
- }
491
-
492
- return result;
493
- }
494
-
495
- private _getGenNgRoutingModuleFiles(defs: TTsGenNgRoutingModuleDef[]): { filePath: string; content: string }[] {
496
- const result: { filePath: string; content: string }[] = [];
497
-
498
- for (const def of defs) {
499
- const fn = (children: TTsGenNgRoutingModuleDefChild[]): string => {
500
- let fnResult = "[\n";
501
- for (const child of children) {
502
- fnResult += " {\n";
503
- fnResult += ` path: "${child.path}",\n`;
504
- if ("target" in child) {
505
- fnResult += ` loadChildren: () => import("${this._getFileImportModuleName(def.filePath, child.target.filePath)}").then((m) => m.${child.target.name})\n`;
506
- }
507
- else {
508
- fnResult += ` children: ${fn(child.children).replace(/\n/g, "\n ")}\n`;
509
- }
510
- fnResult += " },\n";
511
- }
512
- fnResult = fnResult.slice(0, -2) + "\n";
513
- fnResult += "]";
514
-
515
- return fnResult;
516
- };
517
-
518
- const content = "component" in def ? `
519
- import { NgModule } from "@angular/core";
520
- import { RouterModule } from "@angular/router";
521
- import { SdCanDeactivateGuard } from "@simplysm/sd-angular";
522
- import { ${def.component.name} } from "${this._getFileImportModuleName(def.filePath, def.component.filePath)}";
523
-
524
- @NgModule({
525
- imports: [
526
- RouterModule.forChild([
527
- {
528
- path: "",
529
- component: ${def.component.name},
530
- canDeactivate: [SdCanDeactivateGuard]${def.children ? `,
531
- children: ${fn(def.children).replace(/\n/g, "\n ")}` : ""}
532
- }
533
- ])
534
- ],
535
- exports: [RouterModule]
536
- })
537
- export class ${def.name} {
538
- }`.trim() : `
539
- import { Routes } from "@angular/router";
540
-
541
- export const routes: Routes = ${fn(def.children)};
542
- `.trim();
543
-
544
- result.push({ filePath: def.filePath + ".ts", content });
545
- }
546
-
547
- return result;
548
- }
549
-
550
- private _getGenNgModuleFiles(mods: ITsGenNgModuleDef[]): { filePath: string; content: string }[] {
551
- const result: { filePath: string; content: string }[] = [];
552
-
553
- for (const mod of mods) {
554
- const importMap = [...mod.imports, ...mod.exports, ...mod.providers]
555
- .map((item) => ({
556
- moduleName: "moduleName" in item ? item.moduleName : this._getFileImportModuleName(mod.filePath, item.filePath),
557
- name: item.name
558
- }))
559
- .groupBy((item) => item.moduleName)
560
- .toMap((item) => item.key, (item) => item.values.map((v) => v.name));
561
- importMap.getOrCreate("@angular/core", []).push("NgModule");
562
-
563
- const importTexts: string[] = [];
564
- for (const moduleName of Array.from(importMap.keys()).orderBy()) {
565
- const targetNames = importMap.get(moduleName)!.distinct();
566
- if (targetNames.length === 0) continue;
567
- importTexts.push(`import { ${targetNames.join(", ")} } from "${moduleName}";`);
568
- }
569
-
570
- const moduleImportNames = mod.imports.map((item) => item.name);
571
- if (
572
- this._routeOpts !== undefined
573
- && mod.filePath.endsWith(this._routeOpts.fileEndsWith + "Module")
574
- && mod.name !== this._routeOpts.rootClassName + "Module"
575
- ) {
576
- const routingModuleName = mod.name.replace(/Module$/, "RoutingModule");
577
- importTexts.push(`import { ${routingModuleName} } from "./${routingModuleName}";`);
578
- moduleImportNames.push(routingModuleName);
579
- }
580
-
581
- const content = `
582
- ${importTexts.join("\n")}
583
-
584
- @NgModule({
585
- imports: [${moduleImportNames.orderBy().join(", ")}],
586
- declarations: [${mod.exports.map((item) => item.name).distinct().orderBy().join(", ")}],
587
- exports: [${mod.exports.map((item) => item.name).distinct().orderBy().join(", ")}],
588
- providers: [${mod.providers.map((item) => item.name).distinct().orderBy().join(", ")}]
589
- })
590
- export class ${mod.name} {
591
- }`.trim();
592
-
593
- result.push({ filePath: mod.filePath + ".ts", content });
594
- }
595
-
596
- return result;
597
- }
598
-
599
- private async _writeFilesAsync(files: { filePath: string; content: string }[]): Promise<void> {
600
- for (const file of files) {
601
- if (this._fileWriterCache.get(file.filePath) !== file.content) {
602
- await FsUtil.writeFileAsync(file.filePath, file.content);
603
- this._fileWriterCache.set(file.filePath, file.content);
604
- }
605
- }
606
-
607
- const glob = await FsUtil.globAsync(path.resolve(this._modulesPath, "**", "*"));
608
- for (const currFilePath of glob) {
609
- if (!files.some((item) => item.filePath.startsWith(currFilePath))) {
610
- await FsUtil.removeAsync(currFilePath);
611
- this._fileWriterCache.delete(currFilePath);
612
- }
613
- }
614
- }
615
-
616
- private _getFileImportModuleName(mainFilePath: string, importFilePath: string): string {
617
- const filePath = PathUtil.posix(path.relative(path.dirname(mainFilePath), importFilePath).replace(/\.ts$/, ""));
618
- return filePath.startsWith(".") ? filePath : "./" + filePath;
619
- }
620
- }
621
-
622
- interface IBbNgModuleDef {
623
- moduleName: string;
624
- name: string;
625
- providers: { moduleName: string; name: string }[];
626
- exports: { moduleName: string; name: string }[];
627
- selectors: string[];
628
- pipeNames: string[];
629
- }
630
-
631
- interface ITsNgPresetModuleDef {
632
- filePath: string;
633
- name: string;
634
- source?: { filePath: string; name: string };
635
- selector?: string;
636
- pipeName?: string;
637
- }
638
-
639
- interface ITsNgPresetSourceDef {
640
- filePath: string;
641
- name: string;
642
- module: { filePath: string; name: string };
643
- imports: TSdCliMetaRef[];
644
- template?: string;
645
- isProvider: boolean;
646
- }
647
-
648
- interface ITsGenNgModuleDef {
649
- filePath: string;
650
- name: string;
651
- imports: TSdCliMetaRef[];
652
- exports: { filePath: string; name: string }[];
653
- providers: { filePath: string; name: string }[];
654
- }
655
-
656
- type TTsGenNgRoutingModuleDef = {
657
- filePath: string;
658
- name: string;
659
- component: { filePath: string; name: string };
660
- children?: TTsGenNgRoutingModuleDefChild[];
661
- } | {
662
- filePath: string;
663
- children: TTsGenNgRoutingModuleDefChild[];
664
- };
665
-
666
- type TTsGenNgRoutingModuleDefChild = {
667
- path: string;
668
- target: { filePath: string; name: string };
669
- } | {
670
- path: string;
671
- children: TTsGenNgRoutingModuleDefChild[];
672
- };