@simplysm/sd-cli 10.0.4 → 10.0.22

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 (286) hide show
  1. package/.eslintrc.cjs +1 -1
  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 -1
  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 +3 -7
  14. package/dist/builders/SdCliJsLibLinter.js.map +1 -1
  15. package/dist/builders/{SdCliJsLibLinter.js → SdCliJsLibLinter.mjs} +8 -17
  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 +3 -10
  20. package/dist/builders/SdCliTsLibBuilder.js.map +1 -1
  21. package/dist/builders/SdCliTsLibBuilder.mjs +75 -0
  22. package/dist/commons.d.ts +28 -2
  23. package/dist/entry/SdCliLocalUpdate.d.ts +7 -0
  24. package/dist/entry/SdCliLocalUpdate.js.map +1 -0
  25. package/dist/entry/SdCliLocalUpdate.mjs +55 -0
  26. package/dist/entry/SdCliProject.d.ts +1 -0
  27. package/dist/entry/SdCliProject.js.map +1 -1
  28. package/dist/entry/{SdCliProject.js → SdCliProject.mjs} +94 -10
  29. package/dist/sd-cli.js.map +1 -1
  30. package/dist/{sd-cli.js → sd-cli.mjs} +16 -0
  31. package/dist/sd-core-common/src/decorators/NotifyPropertyChange.d.ts +20 -0
  32. package/dist/sd-core-common/src/decorators/NotifyPropertyChange.js.map +1 -0
  33. package/dist/sd-core-common/src/decorators/NotifyPropertyChange.mjs +12 -0
  34. package/dist/sd-core-common/src/decorators/PropertyGetSetDecoratorBase.d.ts +43 -0
  35. package/dist/sd-core-common/src/decorators/PropertyGetSetDecoratorBase.js.map +1 -0
  36. package/dist/sd-core-common/src/decorators/PropertyGetSetDecoratorBase.mjs +54 -0
  37. package/dist/sd-core-common/src/decorators/PropertyValidate.d.ts +16 -0
  38. package/dist/sd-core-common/src/decorators/PropertyValidate.js.map +1 -0
  39. package/dist/sd-core-common/src/decorators/PropertyValidate.mjs +26 -0
  40. package/dist/sd-core-common/src/decorators/decorator-return-types.d.ts +14 -0
  41. package/dist/sd-core-common/src/decorators/decorator-return-types.js.map +1 -0
  42. package/dist/sd-core-common/src/decorators/decorator-return-types.mjs +2 -0
  43. package/dist/sd-core-common/src/errors/ArgumentError.d.ts +10 -0
  44. package/dist/sd-core-common/src/errors/ArgumentError.js.map +1 -0
  45. package/dist/sd-core-common/src/errors/ArgumentError.mjs +13 -0
  46. package/dist/sd-core-common/src/errors/NeverEntryError.d.ts +10 -0
  47. package/dist/sd-core-common/src/errors/NeverEntryError.js.map +1 -0
  48. package/dist/sd-core-common/src/errors/NeverEntryError.mjs +13 -0
  49. package/dist/sd-core-common/src/errors/NotImplementError.d.ts +10 -0
  50. package/dist/sd-core-common/src/errors/NotImplementError.js.map +1 -0
  51. package/dist/sd-core-common/src/errors/NotImplementError.mjs +13 -0
  52. package/dist/sd-core-common/src/errors/SdError.d.ts +23 -0
  53. package/dist/sd-core-common/src/errors/SdError.js.map +1 -0
  54. package/dist/sd-core-common/src/errors/SdError.mjs +40 -0
  55. package/dist/sd-core-common/src/errors/TimeoutError.d.ts +11 -0
  56. package/dist/sd-core-common/src/errors/TimeoutError.js.map +1 -0
  57. package/dist/sd-core-common/src/errors/TimeoutError.mjs +16 -0
  58. package/dist/sd-core-common/src/extensions/ArrayExtension.d.ts +147 -0
  59. package/dist/sd-core-common/src/extensions/ArrayExtension.js.map +1 -0
  60. package/dist/sd-core-common/src/extensions/ArrayExtension.mjs +448 -0
  61. package/dist/sd-core-common/src/extensions/MapExtension.d.ts +4 -0
  62. package/dist/sd-core-common/src/extensions/MapExtension.js.map +1 -0
  63. package/dist/sd-core-common/src/extensions/MapExtension.mjs +15 -0
  64. package/dist/sd-core-common/src/extensions/SetExtension.d.ts +3 -0
  65. package/dist/sd-core-common/src/extensions/SetExtension.js.map +1 -0
  66. package/dist/sd-core-common/src/extensions/SetExtension.mjs +10 -0
  67. package/dist/sd-core-common/src/index.d.ts +32 -0
  68. package/dist/sd-core-common/src/index.js.map +1 -0
  69. package/dist/sd-core-common/src/index.mjs +33 -0
  70. package/dist/sd-core-common/src/types/DateOnly.d.ts +135 -0
  71. package/dist/sd-core-common/src/types/DateOnly.js.map +1 -0
  72. package/dist/sd-core-common/src/types/DateOnly.mjs +220 -0
  73. package/dist/sd-core-common/src/types/DateTime.d.ts +42 -0
  74. package/dist/sd-core-common/src/types/DateTime.js.map +1 -0
  75. package/dist/sd-core-common/src/types/DateTime.mjs +156 -0
  76. package/dist/sd-core-common/src/types/DeepPartial.d.ts +3 -0
  77. package/dist/sd-core-common/src/types/DeepPartial.js.map +1 -0
  78. package/dist/sd-core-common/src/types/DeepPartial.mjs +2 -0
  79. package/dist/sd-core-common/src/types/ObjectSet.d.ts +4 -0
  80. package/dist/sd-core-common/src/types/ObjectSet.js.map +1 -0
  81. package/dist/sd-core-common/src/types/ObjectSet.mjs +18 -0
  82. package/dist/sd-core-common/src/types/Time.d.ts +27 -0
  83. package/dist/sd-core-common/src/types/Time.js.map +1 -0
  84. package/dist/sd-core-common/src/types/Time.mjs +108 -0
  85. package/dist/sd-core-common/src/types/Type.d.ts +7 -0
  86. package/dist/sd-core-common/src/types/Type.js.map +1 -0
  87. package/dist/sd-core-common/src/types/Type.mjs +2 -0
  88. package/dist/sd-core-common/src/types/UnwrappedType.d.ts +1 -0
  89. package/dist/sd-core-common/src/types/UnwrappedType.js.map +1 -0
  90. package/dist/sd-core-common/src/types/UnwrappedType.mjs +2 -0
  91. package/dist/sd-core-common/src/types/Uuid.d.ts +8 -0
  92. package/dist/sd-core-common/src/types/Uuid.js.map +1 -0
  93. package/dist/sd-core-common/src/types/Uuid.mjs +26 -0
  94. package/dist/sd-core-common/src/types/WrappedType.d.ts +1 -0
  95. package/dist/sd-core-common/src/types/WrappedType.js.map +1 -0
  96. package/dist/sd-core-common/src/types/WrappedType.mjs +2 -0
  97. package/dist/sd-core-common/src/utils/DateTimeFormatUtil.d.ts +12 -0
  98. package/dist/sd-core-common/src/utils/DateTimeFormatUtil.js.map +1 -0
  99. package/dist/sd-core-common/src/utils/DateTimeFormatUtil.mjs +67 -0
  100. package/dist/sd-core-common/src/utils/FunctionQueue.d.ts +8 -0
  101. package/dist/sd-core-common/src/utils/FunctionQueue.js.map +1 -0
  102. package/dist/sd-core-common/src/utils/FunctionQueue.mjs +46 -0
  103. package/dist/sd-core-common/src/utils/FunctionUtil.d.ts +6 -0
  104. package/dist/sd-core-common/src/utils/FunctionUtil.js.map +1 -0
  105. package/dist/sd-core-common/src/utils/FunctionUtil.mjs +31 -0
  106. package/dist/sd-core-common/src/utils/JsonConvert.d.ts +8 -0
  107. package/dist/sd-core-common/src/utils/JsonConvert.js.map +1 -0
  108. package/dist/sd-core-common/src/utils/JsonConvert.mjs +78 -0
  109. package/dist/sd-core-common/src/utils/MathUtil.d.ts +3 -0
  110. package/dist/sd-core-common/src/utils/MathUtil.js.map +1 -0
  111. package/dist/sd-core-common/src/utils/MathUtil.mjs +6 -0
  112. package/dist/sd-core-common/src/utils/NumberUtil.d.ts +6 -0
  113. package/dist/sd-core-common/src/utils/NumberUtil.js.map +1 -0
  114. package/dist/sd-core-common/src/utils/NumberUtil.mjs +32 -0
  115. package/dist/sd-core-common/src/utils/ObjectUtil.d.ts +80 -0
  116. package/dist/sd-core-common/src/utils/ObjectUtil.js.map +1 -0
  117. package/dist/sd-core-common/src/utils/ObjectUtil.mjs +452 -0
  118. package/dist/sd-core-common/src/utils/SdSyncEventEmitter.d.ts +6 -0
  119. package/dist/sd-core-common/src/utils/SdSyncEventEmitter.js.map +1 -0
  120. package/dist/sd-core-common/src/utils/SdSyncEventEmitter.mjs +27 -0
  121. package/dist/sd-core-common/src/utils/StringUtil.d.ts +8 -0
  122. package/dist/sd-core-common/src/utils/StringUtil.js.map +1 -0
  123. package/dist/sd-core-common/src/utils/StringUtil.mjs +77 -0
  124. package/dist/sd-core-common/src/utils/Wait.d.ts +4 -0
  125. package/dist/sd-core-common/src/utils/Wait.js.map +1 -0
  126. package/dist/sd-core-common/src/utils/Wait.mjs +23 -0
  127. package/dist/sd-core-node/src/index.d.ts +6 -0
  128. package/dist/sd-core-node/src/index.js.map +1 -0
  129. package/dist/sd-core-node/src/index.mjs +7 -0
  130. package/dist/sd-core-node/src/utils/FsUtil.d.ts +44 -0
  131. package/dist/sd-core-node/src/utils/FsUtil.js.map +1 -0
  132. package/dist/sd-core-node/src/utils/FsUtil.mjs +493 -0
  133. package/dist/sd-core-node/src/utils/Logger.d.ts +91 -0
  134. package/dist/sd-core-node/src/utils/Logger.js.map +1 -0
  135. package/dist/sd-core-node/src/utils/Logger.mjs +185 -0
  136. package/dist/sd-core-node/src/utils/PathUtil.d.ts +6 -0
  137. package/dist/sd-core-node/src/utils/PathUtil.js.map +1 -0
  138. package/dist/sd-core-node/src/utils/PathUtil.mjs +24 -0
  139. package/dist/sd-core-node/src/utils/SdFsWatcher.d.ts +15 -0
  140. package/dist/sd-core-node/src/utils/SdFsWatcher.js.map +1 -0
  141. package/dist/sd-core-node/src/utils/SdFsWatcher.mjs +43 -0
  142. package/dist/sd-core-node/src/utils/SdProcess.d.ts +5 -0
  143. package/dist/sd-core-node/src/utils/SdProcess.js.map +1 -0
  144. package/dist/sd-core-node/src/utils/SdProcess.mjs +36 -0
  145. package/dist/sd-orm-common/src/CaseQueryHelper.d.ts +12 -0
  146. package/dist/sd-orm-common/src/CaseQueryHelper.js.map +1 -0
  147. package/dist/sd-orm-common/src/CaseQueryHelper.mjs +19 -0
  148. package/dist/sd-orm-common/src/CaseWhenQueryHelper.d.ts +12 -0
  149. package/dist/sd-orm-common/src/CaseWhenQueryHelper.js.map +1 -0
  150. package/dist/sd-orm-common/src/CaseWhenQueryHelper.mjs +20 -0
  151. package/dist/sd-orm-common/src/DbContext.d.ts +81 -0
  152. package/dist/sd-orm-common/src/DbContext.js.map +1 -0
  153. package/dist/sd-orm-common/src/DbContext.mjs +635 -0
  154. package/dist/sd-orm-common/src/IDbConnection.d.ts +15 -0
  155. package/dist/sd-orm-common/src/IDbConnection.js.map +1 -0
  156. package/dist/sd-orm-common/src/IDbConnection.mjs +2 -0
  157. package/dist/sd-orm-common/src/IDbContextExecutor.d.ts +17 -0
  158. package/dist/sd-orm-common/src/IDbContextExecutor.js.map +1 -0
  159. package/dist/sd-orm-common/src/IDbContextExecutor.mjs +2 -0
  160. package/dist/sd-orm-common/src/IDbMigration.d.ts +4 -0
  161. package/dist/sd-orm-common/src/IDbMigration.js.map +1 -0
  162. package/dist/sd-orm-common/src/IDbMigration.mjs +2 -0
  163. package/dist/sd-orm-common/src/QueryBuilder.d.ts +48 -0
  164. package/dist/sd-orm-common/src/QueryBuilder.js.map +1 -0
  165. package/dist/sd-orm-common/src/QueryBuilder.mjs +1022 -0
  166. package/dist/sd-orm-common/src/QueryHelper.d.ts +75 -0
  167. package/dist/sd-orm-common/src/QueryHelper.js.map +1 -0
  168. package/dist/sd-orm-common/src/QueryHelper.mjs +627 -0
  169. package/dist/sd-orm-common/src/QueryUnit.d.ts +10 -0
  170. package/dist/sd-orm-common/src/QueryUnit.js.map +1 -0
  171. package/dist/sd-orm-common/src/QueryUnit.mjs +16 -0
  172. package/dist/sd-orm-common/src/Queryable.d.ts +105 -0
  173. package/dist/sd-orm-common/src/Queryable.js.map +1 -0
  174. package/dist/sd-orm-common/src/Queryable.mjs +1375 -0
  175. package/dist/sd-orm-common/src/SdOrmDataType.d.ts +21 -0
  176. package/dist/sd-orm-common/src/SdOrmDataType.js.map +1 -0
  177. package/dist/sd-orm-common/src/SdOrmDataType.mjs +2 -0
  178. package/dist/sd-orm-common/src/commons.d.ts +400 -0
  179. package/dist/sd-orm-common/src/commons.js.map +1 -0
  180. package/dist/sd-orm-common/src/commons.mjs +8 -0
  181. package/dist/sd-orm-common/src/decorators.d.ts +29 -0
  182. package/dist/sd-orm-common/src/decorators.js.map +1 -0
  183. package/dist/sd-orm-common/src/decorators.mjs +89 -0
  184. package/dist/sd-orm-common/src/index.d.ts +17 -0
  185. package/dist/sd-orm-common/src/index.js.map +1 -0
  186. package/dist/sd-orm-common/src/index.mjs +18 -0
  187. package/dist/sd-orm-common/src/models/SystemMigration.d.ts +3 -0
  188. package/dist/sd-orm-common/src/models/SystemMigration.js.map +1 -0
  189. package/dist/sd-orm-common/src/models/SystemMigration.mjs +13 -0
  190. package/dist/sd-orm-common/src/utils/DbDefinitionUtil.d.ts +14 -0
  191. package/dist/sd-orm-common/src/utils/DbDefinitionUtil.js.map +1 -0
  192. package/dist/sd-orm-common/src/utils/DbDefinitionUtil.mjs +66 -0
  193. package/dist/sd-orm-common/src/utils/SdOrmUtil.d.ts +8 -0
  194. package/dist/sd-orm-common/src/utils/SdOrmUtil.js.map +1 -0
  195. package/dist/sd-orm-common/src/utils/SdOrmUtil.mjs +248 -0
  196. package/dist/sd-orm-node/src/DbConnectionFactory.d.ts +4 -0
  197. package/dist/sd-orm-node/src/DbConnectionFactory.js.map +1 -0
  198. package/dist/sd-orm-node/src/DbConnectionFactory.mjs +17 -0
  199. package/dist/sd-orm-node/src/NodeDbContextExecutor.d.ts +19 -0
  200. package/dist/sd-orm-node/src/NodeDbContextExecutor.js.map +1 -0
  201. package/dist/sd-orm-node/src/NodeDbContextExecutor.mjs +71 -0
  202. package/dist/sd-orm-node/src/SdOrm.d.ts +10 -0
  203. package/dist/sd-orm-node/src/SdOrm.js.map +1 -0
  204. package/dist/sd-orm-node/src/SdOrm.mjs +25 -0
  205. package/dist/sd-orm-node/src/index.d.ts +4 -0
  206. package/dist/sd-orm-node/src/index.js.map +1 -0
  207. package/dist/sd-orm-node/src/index.mjs +5 -0
  208. package/dist/sd-orm-node-mssql/src/MssqlDbConnection.d.ts +25 -0
  209. package/dist/sd-orm-node-mssql/src/MssqlDbConnection.js.map +1 -0
  210. package/dist/sd-orm-node-mssql/src/MssqlDbConnection.mjs +321 -0
  211. package/dist/sd-orm-node-mssql/src/index.d.ts +2 -0
  212. package/dist/sd-orm-node-mssql/src/index.js.map +1 -0
  213. package/dist/sd-orm-node-mssql/src/index.mjs +3 -0
  214. package/dist/sd-orm-node-mysql/src/MysqlDbConnection.d.ts +22 -0
  215. package/dist/sd-orm-node-mysql/src/MysqlDbConnection.js.map +1 -0
  216. package/dist/sd-orm-node-mysql/src/MysqlDbConnection.mjs +200 -0
  217. package/dist/sd-orm-node-mysql/src/index.d.ts +2 -0
  218. package/dist/sd-orm-node-mysql/src/index.js.map +1 -0
  219. package/dist/sd-orm-node-mysql/src/index.mjs +3 -0
  220. package/dist/sd-orm-node-sqlite/src/SqliteDbConnection.d.ts +22 -0
  221. package/dist/sd-orm-node-sqlite/src/SqliteDbConnection.js.map +1 -0
  222. package/dist/sd-orm-node-sqlite/src/SqliteDbConnection.mjs +172 -0
  223. package/dist/sd-orm-node-sqlite/src/index.d.ts +2 -0
  224. package/dist/sd-orm-node-sqlite/src/index.js.map +1 -0
  225. package/dist/sd-orm-node-sqlite/src/index.mjs +3 -0
  226. package/dist/sd-service-common/src/commons-orm.d.ts +4 -0
  227. package/dist/sd-service-common/src/commons-orm.js.map +1 -0
  228. package/dist/sd-service-common/src/commons-orm.mjs +2 -0
  229. package/dist/sd-service-common/src/commons-smtp.d.ts +29 -0
  230. package/dist/sd-service-common/src/commons-smtp.js.map +1 -0
  231. package/dist/sd-service-common/src/commons-smtp.mjs +2 -0
  232. package/dist/sd-service-common/src/commons.d.ts +57 -0
  233. package/dist/sd-service-common/src/commons.js.map +1 -0
  234. package/dist/sd-service-common/src/commons.mjs +3 -0
  235. package/dist/sd-service-common/src/index.d.ts +3 -0
  236. package/dist/sd-service-common/src/index.js.map +1 -0
  237. package/dist/sd-service-common/src/index.mjs +4 -0
  238. package/dist/sd-service-server/src/ApiServiceError.d.ts +12 -0
  239. package/dist/sd-service-server/src/ApiServiceError.js.map +1 -0
  240. package/dist/sd-service-server/src/ApiServiceError.mjs +15 -0
  241. package/dist/sd-service-server/src/SdServiceServer.d.ts +39 -0
  242. package/dist/sd-service-server/src/SdServiceServer.js.map +1 -0
  243. package/dist/sd-service-server/src/SdServiceServer.mjs +513 -0
  244. package/dist/sd-service-server/src/commons.d.ts +23 -0
  245. package/dist/sd-service-server/src/commons.js.map +1 -0
  246. package/dist/sd-service-server/src/commons.mjs +3 -0
  247. package/dist/sd-service-server/src/index.d.ts +8 -0
  248. package/dist/sd-service-server/src/index.js.map +1 -0
  249. package/dist/sd-service-server/src/index.mjs +9 -0
  250. package/dist/sd-service-server/src/services/SdAutoUpdateService.d.ts +4 -0
  251. package/dist/sd-service-server/src/services/SdAutoUpdateService.js.map +1 -0
  252. package/dist/sd-service-server/src/services/SdAutoUpdateService.mjs +20 -0
  253. package/dist/sd-service-server/src/services/SdCryptoService.d.ts +7 -0
  254. package/dist/sd-service-server/src/services/SdCryptoService.js.map +1 -0
  255. package/dist/sd-service-server/src/services/SdCryptoService.mjs +39 -0
  256. package/dist/sd-service-server/src/services/SdOrmService.d.ts +22 -0
  257. package/dist/sd-service-server/src/services/SdOrmService.js.map +1 -0
  258. package/dist/sd-service-server/src/services/SdOrmService.mjs +115 -0
  259. package/dist/sd-service-server/src/services/SdSmtpClientService.d.ts +6 -0
  260. package/dist/sd-service-server/src/services/SdSmtpClientService.js.map +1 -0
  261. package/dist/sd-service-server/src/services/SdSmtpClientService.mjs +44 -0
  262. package/dist/sd-service-server/src/utils/SdServiceServerConfigUtil.d.ts +4 -0
  263. package/dist/sd-service-server/src/utils/SdServiceServerConfigUtil.js.map +1 -0
  264. package/dist/sd-service-server/src/utils/SdServiceServerConfigUtil.mjs +36 -0
  265. package/dist/server-worker.d.ts +1 -0
  266. package/dist/server-worker.js.map +1 -0
  267. package/dist/server-worker.mjs +36 -0
  268. package/package.json +12 -5
  269. package/src/SdLinter.ts +41 -0
  270. package/src/SdTsIncrementalBuilder.ts +75 -0
  271. package/src/build-cluster.ts +69 -18
  272. package/src/builders/SdCliClientBuilder.ts +189 -0
  273. package/src/builders/SdCliJsLibLinter.ts +11 -23
  274. package/src/builders/SdCliServerBuilder.ts +191 -0
  275. package/src/builders/SdCliTsLibBuilder.ts +33 -202
  276. package/src/commons.ts +33 -2
  277. package/src/entry/SdCliLocalUpdate.ts +70 -0
  278. package/src/entry/SdCliProject.ts +133 -17
  279. package/src/sd-cli.ts +20 -0
  280. package/src/server-worker.ts +45 -0
  281. package/tsconfig.json +1 -10
  282. package/dist/build-cluster.js +0 -75
  283. package/dist/builders/SdCliTsLibBuilder.js +0 -205
  284. /package/dist/{commons.js → commons.mjs} +0 -0
  285. /package/dist/utils/{SdCliBuildResultUtil.js → SdCliBuildResultUtil.mjs} +0 -0
  286. /package/dist/utils/{SdCliConfigUtil.js → SdCliConfigUtil.mjs} +0 -0
@@ -0,0 +1,45 @@
1
+ import { EventEmitter } from "events";
2
+ import { Logger, LoggerSeverity } from "@simplysm/sd-core-node";
3
+ import path from "path";
4
+ import { pathToFileURL } from "url";
5
+ import { SdServiceServer } from "@simplysm/sd-service-server";
6
+
7
+ Error.stackTraceLimit = Infinity;
8
+ EventEmitter.defaultMaxListeners = 0;
9
+
10
+ if (Boolean(process.env["SD_DEBUG"])) {
11
+ Logger.setConfig({
12
+ console: {
13
+ level: LoggerSeverity.debug
14
+ }
15
+ });
16
+ }
17
+ else {
18
+ Logger.setConfig({
19
+ dot: true
20
+ });
21
+ }
22
+
23
+ const logger = Logger.get(["simplysm", "sd-cli", "server-worker"]);
24
+
25
+ const pkgPath = process.argv[2];
26
+
27
+ const mainFilePath = path.resolve(pkgPath, "dist/main.mjs");
28
+
29
+ const serverModule = await import(pathToFileURL(mainFilePath).href);
30
+
31
+ const server = serverModule.default as SdServiceServer | undefined;
32
+ if (server === undefined) {
33
+ logger.error(`${mainFilePath}(0, 0): 'SdServiceServer'를 'export'해야 합니다.`);
34
+ process.exit();
35
+ }
36
+
37
+ server.on("ready", () => {
38
+ process.send!({ port: server.options.port });
39
+ });
40
+
41
+ process.on("message", (message: any) => {
42
+ if (message.type === "setPathProxy") {
43
+ server.pathProxy = message.pathProxy;
44
+ }
45
+ });
package/tsconfig.json CHANGED
@@ -4,15 +4,6 @@
4
4
  "lib": [
5
5
  "ES2021"
6
6
  ],
7
- "outDir": "./dist",
8
- "baseUrl": ".",
9
- "paths": {
10
- "@simplysm/sd-core-common": [
11
- "../sd-core-common/src/index.ts"
12
- ],
13
- "@simplysm/sd-core-node": [
14
- "../sd-core-node/src/index.ts"
15
- ]
16
- }
7
+ "outDir": "./dist"
17
8
  }
18
9
  }
@@ -1,75 +0,0 @@
1
- import cluster from "node:cluster";
2
- import { SdCliTsLibBuilder } from "./builders/SdCliTsLibBuilder";
3
- import { FsUtil, Logger, LoggerSeverity } from "@simplysm/sd-core-node";
4
- import path from "path";
5
- import { SdCliJsLibLinter } from "./builders/SdCliJsLibLinter";
6
- if (Boolean(process.env["SD_DEBUG"])) {
7
- Logger.setConfig({
8
- console: {
9
- level: LoggerSeverity.debug
10
- }
11
- });
12
- }
13
- else {
14
- Logger.setConfig({
15
- dot: true
16
- });
17
- }
18
- const logger = Logger.get(["simplysm", "sd-cli", "build-cluster"]);
19
- if (cluster.isPrimary) {
20
- logger.debug(`메인 프로세스 ${process.pid} 시작`);
21
- cluster.on("exit", (worker, code) => {
22
- logger.debug(`워커 프로세스 ${worker.process.pid} 종료 (code: ${code})`);
23
- });
24
- cluster.on("message", (worker, message) => {
25
- process.send(message);
26
- });
27
- process.on("message", (message) => {
28
- cluster.fork({
29
- "SD_CLUSTER_MESSAGE": JSON.stringify(message)
30
- });
31
- });
32
- process.send("ready");
33
- }
34
- else {
35
- const message = JSON.parse(process.env["SD_CLUSTER_MESSAGE"]);
36
- if (message.cmd === "watch") {
37
- // javascript
38
- if (!FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
39
- await new SdCliJsLibLinter(message.pkgPath)
40
- .on("change", () => {
41
- process.send({ type: "change", ...message });
42
- })
43
- .on("complete", (result) => {
44
- process.send({ type: "complete", result, ...message });
45
- })
46
- .watchAsync();
47
- process.send({ type: "ready", ...message });
48
- }
49
- // typescript
50
- else {
51
- await new SdCliTsLibBuilder(message.pkgPath)
52
- .on("change", () => {
53
- process.send({ type: "change", ...message });
54
- })
55
- .on("complete", (result) => {
56
- process.send({ type: "complete", result, ...message });
57
- })
58
- .watchAsync();
59
- process.send({ type: "ready", ...message });
60
- }
61
- }
62
- else { // build
63
- // javascript
64
- if (!FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
65
- const result = await new SdCliJsLibLinter(message.pkgPath).buildAsync();
66
- process.send({ type: "complete", result, ...message });
67
- }
68
- // typescript
69
- else {
70
- const result = await new SdCliTsLibBuilder(message.pkgPath).buildAsync();
71
- process.send({ type: "complete", result, ...message });
72
- }
73
- }
74
- }
75
- //# sourceMappingURL=build-cluster.js.map
@@ -1,205 +0,0 @@
1
- import ts from "typescript";
2
- import { FsUtil, Logger, PathUtil, SdFsWatcher } from "@simplysm/sd-core-node";
3
- import path from "path";
4
- import { SdCliBuildResultUtil } from "../utils/SdCliBuildResultUtil";
5
- import { EventEmitter } from "events";
6
- import { ESLint } from "eslint";
7
- import { FunctionQueue } from "@simplysm/sd-core-common";
8
- export class SdCliTsLibBuilder extends EventEmitter {
9
- constructor(_pkgPath) {
10
- super();
11
- this._pkgPath = _pkgPath;
12
- this._logger = Logger.get(["simplysm", "sd-cli", "SdCliTsLibBuilder"]);
13
- this._writeFileCache = new Map();
14
- this._pkgName = path.basename(_pkgPath);
15
- }
16
- on(event, listener) {
17
- super.on(event, listener);
18
- return this;
19
- }
20
- async buildAsync() {
21
- this._debug("빌드 준비...");
22
- const srcGlobPath = path.resolve(this._pkgPath, "src/**/*.ts");
23
- const parsedTsConfig = ts.parseJsonConfigFileContent(await FsUtil.readJsonAsync(path.resolve(this._pkgPath, "tsconfig.json")), ts.sys, this._pkgPath, {
24
- outDir: path.resolve(this._pkgPath, "dist"),
25
- incremental: true,
26
- tsBuildInfoFile: path.resolve(this._pkgPath, ".cache/tsbuildinfo.json"),
27
- });
28
- const host = ts.createIncrementalCompilerHost(parsedTsConfig.options, ts.sys);
29
- this._debug("dist 초기화...");
30
- await FsUtil.removeAsync(path.resolve(this._pkgPath, "dist"));
31
- this._debug("빌드...");
32
- const srcFilePaths = await FsUtil.globAsync(srcGlobPath);
33
- const emitResult = this._emitIncrementalProgram({
34
- rootNames: srcFilePaths,
35
- options: parsedTsConfig.options,
36
- host: host
37
- });
38
- this._debug("LINT...");
39
- const lintResults = await this._lintAsync(emitResult.program.getProgram(), srcFilePaths);
40
- this._debug(`빌드 완료`);
41
- return [...emitResult.buildResults, ...lintResults];
42
- }
43
- async watchAsync() {
44
- this.emit("change");
45
- this._debug("빌드 준비...");
46
- const srcGlobPath = path.resolve(this._pkgPath, "src/**/*.ts");
47
- const parsedTsConfig = ts.parseJsonConfigFileContent(await FsUtil.readJsonAsync(path.resolve(this._pkgPath, "tsconfig.json")), ts.sys, this._pkgPath, {
48
- outDir: path.resolve(this._pkgPath, "dist"),
49
- incremental: true,
50
- tsBuildInfoFile: path.resolve(this._pkgPath, ".cache/tsbuildinfo.json"),
51
- });
52
- const host = ts.createIncrementalCompilerHost(parsedTsConfig.options, ts.sys);
53
- this._debug("dist 초기화...");
54
- await FsUtil.removeAsync(path.resolve(this._pkgPath, "dist"));
55
- this._debug("빌드...");
56
- const srcFilePaths = await FsUtil.globAsync(srcGlobPath);
57
- const emitResult = this._emitIncrementalProgram({
58
- rootNames: srcFilePaths,
59
- options: parsedTsConfig.options,
60
- host: host
61
- });
62
- this._debug("LINT...");
63
- const lintResults = await this._lintAsync(emitResult.program.getProgram(), srcFilePaths);
64
- this._debug(`빌드 완료`);
65
- this.emit("complete", {
66
- affectedFilePaths: srcFilePaths,
67
- buildResults: [...emitResult.buildResults, ...lintResults]
68
- });
69
- const fnQ = new FunctionQueue();
70
- SdFsWatcher
71
- .watch([
72
- ...emitResult.program.getSourceFiles().map((item) => item.fileName),
73
- srcGlobPath
74
- ])
75
- .onChange({
76
- delay: 100
77
- }, () => {
78
- fnQ.runLast(async () => {
79
- this.emit("change");
80
- this._debug(`빌드...`);
81
- const watchSrcFilePaths = await FsUtil.globAsync(srcGlobPath);
82
- const watchResult = this._emitIncrementalProgram({
83
- rootNames: await FsUtil.globAsync(srcGlobPath),
84
- options: parsedTsConfig.options,
85
- host: host
86
- });
87
- const watchAffectedSrcFilePaths = watchResult.affectedFileNames.map((item) => path.resolve(item)).filter((item) => watchSrcFilePaths.includes(item));
88
- this._debug("LINT...");
89
- const watchLintResults = await this._lintAsync(watchResult.program.getProgram(), watchAffectedSrcFilePaths);
90
- this._debug(`빌드 완료`);
91
- this.emit("complete", {
92
- affectedFilePaths: watchAffectedSrcFilePaths,
93
- buildResults: [...watchResult.buildResults, ...watchLintResults]
94
- });
95
- });
96
- });
97
- }
98
- _emitIncrementalProgram(opt) {
99
- const program = ts.createIncrementalProgram({
100
- rootNames: opt.rootNames,
101
- options: opt.options,
102
- host: opt.host,
103
- createProgram: ts.createSemanticDiagnosticsBuilderProgram
104
- });
105
- const diagnostics = [];
106
- const affectedFileNames = [];
107
- diagnostics.push(...program.getOptionsDiagnostics(), ...program.getGlobalDiagnostics());
108
- while (true) {
109
- const semanticResult = program.getSemanticDiagnosticsOfNextAffectedFile(undefined, (sourceFile) => {
110
- return !opt.rootNames.includes(path.resolve(sourceFile.fileName));
111
- });
112
- if (!semanticResult)
113
- break;
114
- diagnostics.push(...semanticResult.result);
115
- /*const result = program.emitNextAffectedFile((filePath, data, writeByteOrderMark) => {
116
- if (this._writeFileCache.get(filePath) !== data) {
117
- ts.sys.writeFile(filePath, data, writeByteOrderMark);
118
- }
119
- this._writeFileCache.set(filePath, data);
120
- });
121
- if (!result) break;*/
122
- if ("fileName" in semanticResult.affected) {
123
- const emitResult = program.emit(program.getSourceFile(semanticResult.affected.fileName), (filePath, data, writeByteOrderMark) => {
124
- let realFilePath = filePath;
125
- if (PathUtil.isChildPath(realFilePath, path.resolve(this._pkgPath, "dist", this._pkgName, "src"))) {
126
- realFilePath = path.resolve(this._pkgPath, "dist", path.relative(path.resolve(this._pkgPath, "dist", this._pkgName, "src"), realFilePath));
127
- }
128
- if (this._writeFileCache.get(realFilePath) !== data) {
129
- ts.sys.writeFile(realFilePath, data, writeByteOrderMark);
130
- }
131
- this._writeFileCache.set(realFilePath, data);
132
- });
133
- diagnostics.push(...emitResult.diagnostics);
134
- affectedFileNames.push(semanticResult.affected.fileName);
135
- diagnostics.push(...program.getSyntacticDiagnostics(semanticResult.affected));
136
- }
137
- }
138
- const buildResults = diagnostics.map((item) => SdCliBuildResultUtil.convertFromTsDiag(item));
139
- return {
140
- program,
141
- buildResults,
142
- affectedFileNames
143
- };
144
- }
145
- /*private readonly _linter = new ESLint({
146
- overrideConfig: {
147
- overrides: [
148
- {
149
- files: ["*.ts"],
150
- parserOptions: {
151
- tsconfigRootDir: this._pkgPath,
152
- project: "tsconfig.json"
153
- },
154
- settings: {
155
- "import/resolver": {
156
- "typescript": {
157
- project: path.resolve(this._pkgPath, "tsconfig.json")
158
- }
159
- }
160
- }
161
- }
162
- ]
163
- }
164
- });*/
165
- async _lintAsync(program, srcFilePaths) {
166
- const linter = new ESLint({
167
- overrideConfig: {
168
- overrides: [
169
- {
170
- files: ["*.ts"],
171
- parserOptions: {
172
- programs: [program],
173
- tsconfigRootDir: null,
174
- project: null,
175
- // tsconfigRootDir: this._pkgPath,
176
- // project: "tsconfig.json"
177
- },
178
- settings: {
179
- "import/resolver": {
180
- "typescript": {
181
- programs: [program],
182
- project: null,
183
- // project: path.resolve(this._pkgPath, "tsconfig.json"),
184
- }
185
- }
186
- }
187
- }
188
- ]
189
- }
190
- });
191
- const lintResults = await linter.lintFiles(srcFilePaths);
192
- return lintResults.mapMany((lintResult) => lintResult.messages.map((msg) => ({
193
- filePath: lintResult.filePath,
194
- line: msg.line,
195
- char: msg.column,
196
- code: msg.ruleId ?? undefined,
197
- severity: msg.severity === 1 ? "warning" : "error",
198
- message: msg.message
199
- })));
200
- }
201
- _debug(msg) {
202
- this._logger.debug(`[${this._pkgName}] ${msg}`);
203
- }
204
- }
205
- //# sourceMappingURL=SdCliTsLibBuilder.js.map
File without changes