@simplysm/sd-cli 12.16.24 → 13.0.0-beta.11

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 (421) hide show
  1. package/README.md +529 -0
  2. package/dist/builders/BaseBuilder.js +86 -0
  3. package/dist/builders/BaseBuilder.js.map +7 -0
  4. package/dist/builders/DtsBuilder.js +109 -0
  5. package/dist/builders/DtsBuilder.js.map +7 -0
  6. package/dist/builders/LibraryBuilder.js +122 -0
  7. package/dist/builders/LibraryBuilder.js.map +7 -0
  8. package/dist/builders/index.js +9 -0
  9. package/dist/builders/index.js.map +7 -0
  10. package/dist/builders/types.js +1 -0
  11. package/dist/builders/types.js.map +7 -0
  12. package/dist/capacitor/capacitor.js +619 -0
  13. package/dist/capacitor/capacitor.js.map +7 -0
  14. package/dist/commands/add-client.js +83 -0
  15. package/dist/commands/add-client.js.map +7 -0
  16. package/dist/commands/add-server.js +91 -0
  17. package/dist/commands/add-server.js.map +7 -0
  18. package/dist/commands/build.js +310 -0
  19. package/dist/commands/build.js.map +7 -0
  20. package/dist/commands/dev.js +426 -0
  21. package/dist/commands/dev.js.map +7 -0
  22. package/dist/commands/device.js +107 -0
  23. package/dist/commands/device.js.map +7 -0
  24. package/dist/commands/init.js +58 -0
  25. package/dist/commands/init.js.map +7 -0
  26. package/dist/commands/lint.js +138 -0
  27. package/dist/commands/lint.js.map +7 -0
  28. package/dist/commands/publish.js +401 -0
  29. package/dist/commands/publish.js.map +7 -0
  30. package/dist/commands/typecheck.js +197 -0
  31. package/dist/commands/typecheck.js.map +7 -0
  32. package/dist/commands/watch.js +19 -0
  33. package/dist/commands/watch.js.map +7 -0
  34. package/dist/core-common/src/common.types.d.ts +74 -0
  35. package/dist/core-common/src/common.types.d.ts.map +1 -0
  36. package/dist/core-common/src/env.d.ts +6 -0
  37. package/dist/core-common/src/env.d.ts.map +1 -0
  38. package/dist/core-common/src/errors/argument-error.d.ts +25 -0
  39. package/dist/core-common/src/errors/argument-error.d.ts.map +1 -0
  40. package/dist/core-common/src/errors/not-implemented-error.d.ts +29 -0
  41. package/dist/core-common/src/errors/not-implemented-error.d.ts.map +1 -0
  42. package/dist/core-common/src/errors/sd-error.d.ts +27 -0
  43. package/dist/core-common/src/errors/sd-error.d.ts.map +1 -0
  44. package/dist/core-common/src/errors/timeout-error.d.ts +31 -0
  45. package/dist/core-common/src/errors/timeout-error.d.ts.map +1 -0
  46. package/dist/core-common/src/extensions/arr-ext.d.ts +15 -0
  47. package/dist/core-common/src/extensions/arr-ext.d.ts.map +1 -0
  48. package/dist/core-common/src/extensions/arr-ext.helpers.d.ts +19 -0
  49. package/dist/core-common/src/extensions/arr-ext.helpers.d.ts.map +1 -0
  50. package/dist/core-common/src/extensions/arr-ext.types.d.ts +215 -0
  51. package/dist/core-common/src/extensions/arr-ext.types.d.ts.map +1 -0
  52. package/dist/core-common/src/extensions/map-ext.d.ts +57 -0
  53. package/dist/core-common/src/extensions/map-ext.d.ts.map +1 -0
  54. package/dist/core-common/src/extensions/set-ext.d.ts +36 -0
  55. package/dist/core-common/src/extensions/set-ext.d.ts.map +1 -0
  56. package/dist/core-common/src/features/debounce-queue.d.ts +53 -0
  57. package/dist/core-common/src/features/debounce-queue.d.ts.map +1 -0
  58. package/dist/core-common/src/features/event-emitter.d.ts +66 -0
  59. package/dist/core-common/src/features/event-emitter.d.ts.map +1 -0
  60. package/dist/core-common/src/features/serial-queue.d.ts +47 -0
  61. package/dist/core-common/src/features/serial-queue.d.ts.map +1 -0
  62. package/dist/core-common/src/index.d.ts +32 -0
  63. package/dist/core-common/src/index.d.ts.map +1 -0
  64. package/dist/core-common/src/types/date-only.d.ts +152 -0
  65. package/dist/core-common/src/types/date-only.d.ts.map +1 -0
  66. package/dist/core-common/src/types/date-time.d.ts +96 -0
  67. package/dist/core-common/src/types/date-time.d.ts.map +1 -0
  68. package/dist/core-common/src/types/lazy-gc-map.d.ts +80 -0
  69. package/dist/core-common/src/types/lazy-gc-map.d.ts.map +1 -0
  70. package/dist/core-common/src/types/time.d.ts +68 -0
  71. package/dist/core-common/src/types/time.d.ts.map +1 -0
  72. package/dist/core-common/src/types/uuid.d.ts +35 -0
  73. package/dist/core-common/src/types/uuid.d.ts.map +1 -0
  74. package/dist/core-common/src/utils/bytes.d.ts +51 -0
  75. package/dist/core-common/src/utils/bytes.d.ts.map +1 -0
  76. package/dist/core-common/src/utils/date-format.d.ts +90 -0
  77. package/dist/core-common/src/utils/date-format.d.ts.map +1 -0
  78. package/dist/core-common/src/utils/json.d.ts +34 -0
  79. package/dist/core-common/src/utils/json.d.ts.map +1 -0
  80. package/dist/core-common/src/utils/num.d.ts +60 -0
  81. package/dist/core-common/src/utils/num.d.ts.map +1 -0
  82. package/dist/core-common/src/utils/obj.d.ts +258 -0
  83. package/dist/core-common/src/utils/obj.d.ts.map +1 -0
  84. package/dist/core-common/src/utils/path.d.ts +23 -0
  85. package/dist/core-common/src/utils/path.d.ts.map +1 -0
  86. package/dist/core-common/src/utils/primitive.d.ts +18 -0
  87. package/dist/core-common/src/utils/primitive.d.ts.map +1 -0
  88. package/dist/core-common/src/utils/str.d.ts +103 -0
  89. package/dist/core-common/src/utils/str.d.ts.map +1 -0
  90. package/dist/core-common/src/utils/template-strings.d.ts +84 -0
  91. package/dist/core-common/src/utils/template-strings.d.ts.map +1 -0
  92. package/dist/core-common/src/utils/transferable.d.ts +47 -0
  93. package/dist/core-common/src/utils/transferable.d.ts.map +1 -0
  94. package/dist/core-common/src/utils/wait.d.ts +19 -0
  95. package/dist/core-common/src/utils/wait.d.ts.map +1 -0
  96. package/dist/core-common/src/utils/xml.d.ts +36 -0
  97. package/dist/core-common/src/utils/xml.d.ts.map +1 -0
  98. package/dist/core-common/src/zip/sd-zip.d.ts +80 -0
  99. package/dist/core-common/src/zip/sd-zip.d.ts.map +1 -0
  100. package/dist/core-node/src/features/fs-watcher.d.ts +70 -0
  101. package/dist/core-node/src/features/fs-watcher.d.ts.map +1 -0
  102. package/dist/core-node/src/index.d.ts +7 -0
  103. package/dist/core-node/src/index.d.ts.map +1 -0
  104. package/dist/core-node/src/utils/fs.d.ts +197 -0
  105. package/dist/core-node/src/utils/fs.d.ts.map +1 -0
  106. package/dist/core-node/src/utils/path.d.ts +75 -0
  107. package/dist/core-node/src/utils/path.d.ts.map +1 -0
  108. package/dist/core-node/src/worker/create-worker.d.ts +23 -0
  109. package/dist/core-node/src/worker/create-worker.d.ts.map +1 -0
  110. package/dist/core-node/src/worker/types.d.ts +67 -0
  111. package/dist/core-node/src/worker/types.d.ts.map +1 -0
  112. package/dist/core-node/src/worker/worker.d.ts +27 -0
  113. package/dist/core-node/src/worker/worker.d.ts.map +1 -0
  114. package/dist/electron/electron.js +242 -0
  115. package/dist/electron/electron.js.map +7 -0
  116. package/dist/index.js +2 -0
  117. package/dist/index.js.map +7 -0
  118. package/dist/infra/ResultCollector.js +59 -0
  119. package/dist/infra/ResultCollector.js.map +7 -0
  120. package/dist/infra/SignalHandler.js +44 -0
  121. package/dist/infra/SignalHandler.js.map +7 -0
  122. package/dist/infra/WorkerManager.js +56 -0
  123. package/dist/infra/WorkerManager.js.map +7 -0
  124. package/dist/infra/index.js +9 -0
  125. package/dist/infra/index.js.map +7 -0
  126. package/dist/orchestrators/WatchOrchestrator.js +135 -0
  127. package/dist/orchestrators/WatchOrchestrator.js.map +7 -0
  128. package/dist/orchestrators/index.js +5 -0
  129. package/dist/orchestrators/index.js.map +7 -0
  130. package/dist/sd-cli/src/builders/BaseBuilder.d.ts +77 -0
  131. package/dist/sd-cli/src/builders/BaseBuilder.d.ts.map +1 -0
  132. package/dist/sd-cli/src/builders/DtsBuilder.d.ts +22 -0
  133. package/dist/sd-cli/src/builders/DtsBuilder.d.ts.map +1 -0
  134. package/dist/sd-cli/src/builders/LibraryBuilder.d.ts +22 -0
  135. package/dist/sd-cli/src/builders/LibraryBuilder.d.ts.map +1 -0
  136. package/dist/sd-cli/src/builders/index.d.ts +5 -0
  137. package/dist/sd-cli/src/builders/index.d.ts.map +1 -0
  138. package/dist/sd-cli/src/builders/types.d.ts +49 -0
  139. package/dist/sd-cli/src/builders/types.d.ts.map +1 -0
  140. package/dist/sd-cli/src/capacitor/capacitor.d.ts +131 -0
  141. package/dist/sd-cli/src/capacitor/capacitor.d.ts.map +1 -0
  142. package/dist/sd-cli/src/commands/add-client.d.ts +18 -0
  143. package/dist/sd-cli/src/commands/add-client.d.ts.map +1 -0
  144. package/dist/sd-cli/src/commands/add-server.d.ts +18 -0
  145. package/dist/sd-cli/src/commands/add-server.d.ts.map +1 -0
  146. package/dist/sd-cli/src/commands/build.d.ts +25 -0
  147. package/dist/sd-cli/src/commands/build.d.ts.map +1 -0
  148. package/dist/sd-cli/src/commands/dev.d.ts +23 -0
  149. package/dist/sd-cli/src/commands/dev.d.ts.map +1 -0
  150. package/dist/sd-cli/src/commands/device.d.ts +22 -0
  151. package/dist/sd-cli/src/commands/device.d.ts.map +1 -0
  152. package/dist/sd-cli/src/commands/init.d.ts +15 -0
  153. package/dist/sd-cli/src/commands/init.d.ts.map +1 -0
  154. package/dist/sd-cli/src/commands/lint.d.ts +31 -0
  155. package/dist/sd-cli/src/commands/lint.d.ts.map +1 -0
  156. package/dist/sd-cli/src/commands/publish.d.ts +27 -0
  157. package/dist/sd-cli/src/commands/publish.d.ts.map +1 -0
  158. package/dist/sd-cli/src/commands/typecheck.d.ts +39 -0
  159. package/dist/sd-cli/src/commands/typecheck.d.ts.map +1 -0
  160. package/dist/sd-cli/src/commands/watch.d.ts +20 -0
  161. package/dist/sd-cli/src/commands/watch.d.ts.map +1 -0
  162. package/dist/sd-cli/src/electron/electron.d.ts +79 -0
  163. package/dist/sd-cli/src/electron/electron.d.ts.map +1 -0
  164. package/dist/sd-cli/src/index.d.ts +2 -0
  165. package/dist/sd-cli/src/index.d.ts.map +1 -0
  166. package/dist/sd-cli/src/infra/ResultCollector.d.ts +56 -0
  167. package/dist/sd-cli/src/infra/ResultCollector.d.ts.map +1 -0
  168. package/dist/sd-cli/src/infra/SignalHandler.d.ts +26 -0
  169. package/dist/sd-cli/src/infra/SignalHandler.d.ts.map +1 -0
  170. package/dist/sd-cli/src/infra/WorkerManager.d.ts +40 -0
  171. package/dist/sd-cli/src/infra/WorkerManager.d.ts.map +1 -0
  172. package/dist/sd-cli/src/infra/index.d.ts +4 -0
  173. package/dist/sd-cli/src/infra/index.d.ts.map +1 -0
  174. package/dist/sd-cli/src/orchestrators/WatchOrchestrator.d.ts +48 -0
  175. package/dist/sd-cli/src/orchestrators/WatchOrchestrator.d.ts.map +1 -0
  176. package/dist/sd-cli/src/orchestrators/index.d.ts +2 -0
  177. package/dist/sd-cli/src/orchestrators/index.d.ts.map +1 -0
  178. package/dist/sd-cli/src/sd-cli.d.ts +9 -0
  179. package/dist/sd-cli/src/sd-cli.d.ts.map +1 -0
  180. package/dist/sd-cli/src/sd-config.types.d.ts +222 -0
  181. package/dist/sd-cli/src/sd-config.types.d.ts.map +1 -0
  182. package/dist/sd-cli/src/utils/build-env.d.ts +5 -0
  183. package/dist/sd-cli/src/utils/build-env.d.ts.map +1 -0
  184. package/dist/sd-cli/src/utils/config-editor.d.ts +17 -0
  185. package/dist/sd-cli/src/utils/config-editor.d.ts.map +1 -0
  186. package/dist/sd-cli/src/utils/esbuild-config.d.ts +49 -0
  187. package/dist/sd-cli/src/utils/esbuild-config.d.ts.map +1 -0
  188. package/dist/sd-cli/src/utils/listr-manager.d.ts +37 -0
  189. package/dist/sd-cli/src/utils/listr-manager.d.ts.map +1 -0
  190. package/dist/sd-cli/src/utils/output-utils.d.ts +21 -0
  191. package/dist/sd-cli/src/utils/output-utils.d.ts.map +1 -0
  192. package/dist/sd-cli/src/utils/package-utils.d.ts +29 -0
  193. package/dist/sd-cli/src/utils/package-utils.d.ts.map +1 -0
  194. package/dist/sd-cli/src/utils/sd-config.d.ts +12 -0
  195. package/dist/sd-cli/src/utils/sd-config.d.ts.map +1 -0
  196. package/dist/sd-cli/src/utils/spawn.d.ts +26 -0
  197. package/dist/sd-cli/src/utils/spawn.d.ts.map +1 -0
  198. package/dist/sd-cli/src/utils/tailwind-config-deps.d.ts +8 -0
  199. package/dist/sd-cli/src/utils/tailwind-config-deps.d.ts.map +1 -0
  200. package/dist/sd-cli/src/utils/template.d.ts +14 -0
  201. package/dist/sd-cli/src/utils/template.d.ts.map +1 -0
  202. package/dist/sd-cli/src/utils/tsconfig.d.ts +35 -0
  203. package/dist/sd-cli/src/utils/tsconfig.d.ts.map +1 -0
  204. package/dist/sd-cli/src/utils/typecheck-serialization.d.ts +28 -0
  205. package/dist/sd-cli/src/utils/typecheck-serialization.d.ts.map +1 -0
  206. package/dist/sd-cli/src/utils/vite-config.d.ts +25 -0
  207. package/dist/sd-cli/src/utils/vite-config.d.ts.map +1 -0
  208. package/dist/sd-cli/src/utils/worker-events.d.ts +53 -0
  209. package/dist/sd-cli/src/utils/worker-events.d.ts.map +1 -0
  210. package/dist/sd-cli/src/workers/client.worker.d.ts +82 -0
  211. package/dist/sd-cli/src/workers/client.worker.d.ts.map +1 -0
  212. package/dist/sd-cli/src/workers/dts.worker.d.ts +73 -0
  213. package/dist/sd-cli/src/workers/dts.worker.d.ts.map +1 -0
  214. package/dist/sd-cli/src/workers/library.worker.d.ts +73 -0
  215. package/dist/sd-cli/src/workers/library.worker.d.ts.map +1 -0
  216. package/dist/sd-cli/src/workers/server-runtime.worker.d.ts +40 -0
  217. package/dist/sd-cli/src/workers/server-runtime.worker.d.ts.map +1 -0
  218. package/dist/sd-cli/src/workers/server.worker.d.ts +76 -0
  219. package/dist/sd-cli/src/workers/server.worker.d.ts.map +1 -0
  220. package/dist/sd-cli.js +239 -76
  221. package/dist/sd-cli.js.map +7 -0
  222. package/dist/sd-config.types.js +1 -0
  223. package/dist/sd-config.types.js.map +7 -0
  224. package/dist/storage/src/clients/ftp-storage-client.d.ts +56 -0
  225. package/dist/storage/src/clients/ftp-storage-client.d.ts.map +1 -0
  226. package/dist/storage/src/clients/sftp-storage-client.d.ts +48 -0
  227. package/dist/storage/src/clients/sftp-storage-client.d.ts.map +1 -0
  228. package/dist/storage/src/index.d.ts +7 -0
  229. package/dist/storage/src/index.d.ts.map +1 -0
  230. package/dist/storage/src/storage-factory.d.ts +20 -0
  231. package/dist/storage/src/storage-factory.d.ts.map +1 -0
  232. package/dist/storage/src/types/storage-conn-config.d.ts +7 -0
  233. package/dist/storage/src/types/storage-conn-config.d.ts.map +1 -0
  234. package/dist/storage/src/types/storage-type.d.ts +2 -0
  235. package/dist/storage/src/types/storage-type.d.ts.map +1 -0
  236. package/dist/storage/src/types/storage.d.ts +19 -0
  237. package/dist/storage/src/types/storage.d.ts.map +1 -0
  238. package/dist/utils/build-env.js +12 -0
  239. package/dist/utils/build-env.js.map +7 -0
  240. package/dist/utils/config-editor.js +77 -0
  241. package/dist/utils/config-editor.js.map +7 -0
  242. package/dist/utils/esbuild-config.js +44 -0
  243. package/dist/utils/esbuild-config.js.map +7 -0
  244. package/dist/utils/listr-manager.js +59 -0
  245. package/dist/utils/listr-manager.js.map +7 -0
  246. package/dist/utils/output-utils.js +40 -0
  247. package/dist/utils/output-utils.js.map +7 -0
  248. package/dist/utils/package-utils.js +28 -0
  249. package/dist/utils/package-utils.js.map +7 -0
  250. package/dist/utils/sd-config.js +24 -0
  251. package/dist/utils/sd-config.js.map +7 -0
  252. package/dist/utils/spawn.js +49 -0
  253. package/dist/utils/spawn.js.map +7 -0
  254. package/dist/utils/tailwind-config-deps.js +80 -0
  255. package/dist/utils/tailwind-config-deps.js.map +7 -0
  256. package/dist/utils/template.js +28 -0
  257. package/dist/utils/template.js.map +7 -0
  258. package/dist/utils/tsconfig.js +62 -0
  259. package/dist/utils/tsconfig.js.map +7 -0
  260. package/dist/utils/typecheck-serialization.js +46 -0
  261. package/dist/utils/typecheck-serialization.js.map +7 -0
  262. package/dist/utils/vite-config.js +108 -0
  263. package/dist/utils/vite-config.js.map +7 -0
  264. package/dist/utils/worker-events.js +38 -0
  265. package/dist/utils/worker-events.js.map +7 -0
  266. package/dist/workers/client.worker.js +94 -0
  267. package/dist/workers/client.worker.js.map +7 -0
  268. package/dist/workers/dts.worker.js +210 -0
  269. package/dist/workers/dts.worker.js.map +7 -0
  270. package/dist/workers/library.worker.js +118 -0
  271. package/dist/workers/library.worker.js.map +7 -0
  272. package/dist/workers/server-runtime.worker.js +85 -0
  273. package/dist/workers/server-runtime.worker.js.map +7 -0
  274. package/dist/workers/server.worker.js +114 -42
  275. package/dist/workers/server.worker.js.map +7 -0
  276. package/package.json +32 -29
  277. package/dist/entry/SdCliAiCommand.d.ts +0 -3
  278. package/dist/entry/SdCliAiCommand.js +0 -91
  279. package/dist/entry/SdCliCapacitor.d.ts +0 -35
  280. package/dist/entry/SdCliCapacitor.js +0 -565
  281. package/dist/entry/SdCliCordova.d.ts +0 -49
  282. package/dist/entry/SdCliCordova.js +0 -394
  283. package/dist/entry/SdCliElectron.d.ts +0 -22
  284. package/dist/entry/SdCliElectron.js +0 -128
  285. package/dist/entry/SdCliLocalUpdate.d.ts +0 -11
  286. package/dist/entry/SdCliLocalUpdate.js +0 -83
  287. package/dist/entry/SdCliPostInstall.d.ts +0 -3
  288. package/dist/entry/SdCliPostInstall.js +0 -48
  289. package/dist/entry/SdCliProject.d.ts +0 -24
  290. package/dist/entry/SdCliProject.js +0 -336
  291. package/dist/pkg-builders/SdBuildRunnerBase.d.ts +0 -14
  292. package/dist/pkg-builders/SdBuildRunnerBase.js +0 -22
  293. package/dist/pkg-builders/SdProjectBuildRunner.d.ts +0 -25
  294. package/dist/pkg-builders/SdProjectBuildRunner.js +0 -264
  295. package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.d.ts +0 -9
  296. package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js +0 -89
  297. package/dist/pkg-builders/client/SdClientBuildRunner.d.ts +0 -10
  298. package/dist/pkg-builders/client/SdClientBuildRunner.js +0 -113
  299. package/dist/pkg-builders/client/SdNgBundler.d.ts +0 -38
  300. package/dist/pkg-builders/client/SdNgBundler.js +0 -525
  301. package/dist/pkg-builders/client/SdNgBundlerContext.d.ts +0 -25
  302. package/dist/pkg-builders/client/SdNgBundlerContext.js +0 -104
  303. package/dist/pkg-builders/client/createSdNgPlugin.d.ts +0 -5
  304. package/dist/pkg-builders/client/createSdNgPlugin.js +0 -133
  305. package/dist/pkg-builders/commons/SdWorkerPathPlugin.d.ts +0 -2
  306. package/dist/pkg-builders/commons/SdWorkerPathPlugin.js +0 -91
  307. package/dist/pkg-builders/lib/SdCliDbContextFileGenerator.d.ts +0 -9
  308. package/dist/pkg-builders/lib/SdCliDbContextFileGenerator.js +0 -138
  309. package/dist/pkg-builders/lib/SdCliIndexFileGenerator.d.ts +0 -11
  310. package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js +0 -79
  311. package/dist/pkg-builders/lib/SdJsLibBuildRunner.d.ts +0 -8
  312. package/dist/pkg-builders/lib/SdJsLibBuildRunner.js +0 -44
  313. package/dist/pkg-builders/lib/SdTsLibBuildRunner.d.ts +0 -8
  314. package/dist/pkg-builders/lib/SdTsLibBuildRunner.js +0 -34
  315. package/dist/pkg-builders/lib/SdTsLibBuilder.d.ts +0 -10
  316. package/dist/pkg-builders/lib/SdTsLibBuilder.js +0 -54
  317. package/dist/pkg-builders/server/SdServerBuildRunner.d.ts +0 -10
  318. package/dist/pkg-builders/server/SdServerBuildRunner.js +0 -228
  319. package/dist/pkg-builders/server/SdServerBundler.d.ts +0 -17
  320. package/dist/pkg-builders/server/SdServerBundler.js +0 -174
  321. package/dist/pkg-builders/server/createSdServerPlugin.d.ts +0 -5
  322. package/dist/pkg-builders/server/createSdServerPlugin.js +0 -53
  323. package/dist/sd-cli-entry.d.ts +0 -2
  324. package/dist/sd-cli-entry.js +0 -230
  325. package/dist/sd-cli.d.ts +0 -2
  326. package/dist/ts-compiler/ScopePathSet.d.ts +0 -7
  327. package/dist/ts-compiler/ScopePathSet.js +0 -12
  328. package/dist/ts-compiler/SdDepAnalyzer.d.ts +0 -15
  329. package/dist/ts-compiler/SdDepAnalyzer.js +0 -299
  330. package/dist/ts-compiler/SdDepCache.d.ts +0 -77
  331. package/dist/ts-compiler/SdDepCache.js +0 -248
  332. package/dist/ts-compiler/SdStyleBundler.d.ts +0 -23
  333. package/dist/ts-compiler/SdStyleBundler.js +0 -131
  334. package/dist/ts-compiler/SdTsCompiler.d.ts +0 -29
  335. package/dist/ts-compiler/SdTsCompiler.js +0 -420
  336. package/dist/types/build/ISdBuildMessage.d.ts +0 -10
  337. package/dist/types/build/ISdBuildMessage.js +0 -1
  338. package/dist/types/build/ISdBuildResult.d.ts +0 -8
  339. package/dist/types/build/ISdBuildResult.js +0 -1
  340. package/dist/types/build/ISdTsCompilerOptions.d.ts +0 -10
  341. package/dist/types/build/ISdTsCompilerOptions.js +0 -1
  342. package/dist/types/build/ISdTsCompilerResult.d.ts +0 -14
  343. package/dist/types/build/ISdTsCompilerResult.js +0 -1
  344. package/dist/types/build/TStylesheetBundlingResult.d.ts +0 -12
  345. package/dist/types/build/TStylesheetBundlingResult.js +0 -1
  346. package/dist/types/common-config/INpmConfig.d.ts +0 -17
  347. package/dist/types/common-config/INpmConfig.js +0 -1
  348. package/dist/types/common-config/ITsConfig.d.ts +0 -7
  349. package/dist/types/common-config/ITsConfig.js +0 -1
  350. package/dist/types/config/ISdProjectConfig.d.ts +0 -144
  351. package/dist/types/config/ISdProjectConfig.js +0 -1
  352. package/dist/types/plugin/ISdCliNgPluginResultCache.d.ts +0 -8
  353. package/dist/types/plugin/ISdCliNgPluginResultCache.js +0 -1
  354. package/dist/types/plugin/ISdCliServerPluginResultCache.d.ts +0 -8
  355. package/dist/types/plugin/ISdCliServerPluginResultCache.js +0 -1
  356. package/dist/types/worker/ISdBuildRunnerWorkerType.d.ts +0 -20
  357. package/dist/types/worker/ISdBuildRunnerWorkerType.js +0 -1
  358. package/dist/types/worker/IServerWorkerType.d.ts +0 -17
  359. package/dist/types/worker/IServerWorkerType.js +0 -1
  360. package/dist/utils/SdCliConvertMessageUtils.d.ts +0 -21
  361. package/dist/utils/SdCliConvertMessageUtils.js +0 -138
  362. package/dist/utils/SdCliPerformanceTimer.d.ts +0 -10
  363. package/dist/utils/SdCliPerformanceTimer.js +0 -50
  364. package/dist/utils/loadProjConfAsync.d.ts +0 -5
  365. package/dist/utils/loadProjConfAsync.js +0 -7
  366. package/dist/workers/build-runner.worker.d.ts +0 -1
  367. package/dist/workers/build-runner.worker.js +0 -37
  368. package/dist/workers/server.worker.d.ts +0 -1
  369. package/lib/cordova-entry.js +0 -29
  370. package/src/entry/SdCliAiCommand.ts +0 -105
  371. package/src/entry/SdCliCapacitor.ts +0 -760
  372. package/src/entry/SdCliCordova.ts +0 -550
  373. package/src/entry/SdCliElectron.ts +0 -197
  374. package/src/entry/SdCliLocalUpdate.ts +0 -106
  375. package/src/entry/SdCliPostInstall.ts +0 -51
  376. package/src/entry/SdCliProject.ts +0 -427
  377. package/src/pkg-builders/SdBuildRunnerBase.ts +0 -36
  378. package/src/pkg-builders/SdProjectBuildRunner.ts +0 -398
  379. package/src/pkg-builders/client/SdCliNgRoutesFileGenerator.ts +0 -112
  380. package/src/pkg-builders/client/SdClientBuildRunner.ts +0 -156
  381. package/src/pkg-builders/client/SdNgBundler.ts +0 -666
  382. package/src/pkg-builders/client/SdNgBundlerContext.ts +0 -138
  383. package/src/pkg-builders/client/createSdNgPlugin.ts +0 -186
  384. package/src/pkg-builders/commons/SdWorkerPathPlugin.ts +0 -117
  385. package/src/pkg-builders/lib/SdCliDbContextFileGenerator.ts +0 -177
  386. package/src/pkg-builders/lib/SdCliIndexFileGenerator.ts +0 -94
  387. package/src/pkg-builders/lib/SdJsLibBuildRunner.ts +0 -59
  388. package/src/pkg-builders/lib/SdTsLibBuildRunner.ts +0 -47
  389. package/src/pkg-builders/lib/SdTsLibBuilder.ts +0 -71
  390. package/src/pkg-builders/server/SdServerBuildRunner.ts +0 -299
  391. package/src/pkg-builders/server/SdServerBundler.ts +0 -208
  392. package/src/pkg-builders/server/createSdServerPlugin.ts +0 -80
  393. package/src/sd-cli-entry.ts +0 -292
  394. package/src/sd-cli.ts +0 -105
  395. package/src/ts-compiler/ScopePathSet.ts +0 -17
  396. package/src/ts-compiler/SdDepAnalyzer.ts +0 -372
  397. package/src/ts-compiler/SdDepCache.ts +0 -304
  398. package/src/ts-compiler/SdStyleBundler.ts +0 -169
  399. package/src/ts-compiler/SdTsCompiler.ts +0 -638
  400. package/src/types/build/ISdBuildMessage.ts +0 -11
  401. package/src/types/build/ISdBuildResult.ts +0 -9
  402. package/src/types/build/ISdTsCompilerOptions.ts +0 -11
  403. package/src/types/build/ISdTsCompilerResult.ts +0 -12
  404. package/src/types/build/TStylesheetBundlingResult.ts +0 -15
  405. package/src/types/common-config/INpmConfig.ts +0 -24
  406. package/src/types/common-config/ITsConfig.ts +0 -5
  407. package/src/types/config/ISdProjectConfig.ts +0 -174
  408. package/src/types/plugin/ISdCliNgPluginResultCache.ts +0 -9
  409. package/src/types/plugin/ISdCliServerPluginResultCache.ts +0 -9
  410. package/src/types/worker/ISdBuildRunnerWorkerType.ts +0 -19
  411. package/src/types/worker/IServerWorkerType.ts +0 -8
  412. package/src/utils/SdCliConvertMessageUtils.ts +0 -180
  413. package/src/utils/SdCliPerformanceTimer.ts +0 -62
  414. package/src/utils/loadProjConfAsync.ts +0 -16
  415. package/src/workers/build-runner.worker.ts +0 -54
  416. package/src/workers/server.worker.ts +0 -54
  417. package/tests/deps/sd-dependency-analyzer.spec.ts +0 -241
  418. package/tests/deps/sd-dependency-cache.spec.ts +0 -153
  419. package/tsconfig.json +0 -8
  420. package/tsconfig.test.json +0 -8
  421. package/vitest.config.js +0 -15
@@ -1,398 +0,0 @@
1
- import {
2
- FsUtils,
3
- PathUtils,
4
- SdFsWatcher,
5
- SdLogger,
6
- SdWorker,
7
- TNormPath,
8
- } from "@simplysm/sd-core-node";
9
- import { ISdProjectConfig, ISdServerPackageConfig } from "../types/config/ISdProjectConfig";
10
- import path from "path";
11
- import { ISdBuildMessage } from "../types/build/ISdBuildMessage";
12
- import { ISdBuildRunnerWorkerType } from "../types/worker/ISdBuildRunnerWorkerType";
13
- import { IServerWorkerType } from "../types/worker/IServerWorkerType";
14
- import { INpmConfig } from "../types/common-config/INpmConfig";
15
-
16
- export class SdProjectBuildRunner {
17
- private static readonly _logger = SdLogger.get(["simplysm", "sd-cli", "SdProjectBuildRunner"]);
18
-
19
- private static readonly _buildInfoMap = new Map<
20
- TNormPath,
21
- {
22
- buildWorker: SdWorker<ISdBuildRunnerWorkerType>;
23
- watchFileSet: Set<TNormPath>;
24
- }
25
- >();
26
-
27
- private static readonly _serverInfoMap = new Map<
28
- string,
29
- {
30
- worker?: SdWorker<any>;
31
- port?: number;
32
- clientMap?: Map<
33
- string,
34
- {
35
- distPath: string;
36
- buildTypes: ("web" | "electron" | "cordova")[];
37
- }
38
- >;
39
- }
40
- >();
41
-
42
- private static readonly _resultCache = new Map<TNormPath, ISdBuildMessage[]>();
43
-
44
- static async watchAsync(opt: {
45
- allPkgPaths: TNormPath[];
46
- pkgPaths: TNormPath[];
47
- projConf: ISdProjectConfig;
48
- emitOnly: boolean;
49
- noEmit: boolean;
50
- onChange: () => void;
51
- onComplete: (buildMessages: ISdBuildMessage[]) => void;
52
- }) {
53
- const scopePathSet = await this._getScopePathSetAsync(
54
- opt.allPkgPaths,
55
- Object.keys(opt.projConf.localUpdates ?? {}),
56
- );
57
-
58
- const watcher = await SdFsWatcher.watchAsync(Array.from(scopePathSet), {
59
- ignoreInitial: false,
60
- });
61
- watcher.onChange({ delay: 300 }, async (changeInfos) => {
62
- // 변경된 패키지 정보 구성
63
- const changeFiles = changeInfos.map((item) => PathUtils.norm(item.path));
64
-
65
- const changedPkgInfos = opt.pkgPaths
66
- .map((pkgPath) => {
67
- let buildInfo = this._buildInfoMap.get(pkgPath);
68
- if (!buildInfo) return { pkgPath };
69
-
70
- const modifiedFileSet = new Set(
71
- changeFiles.filter(
72
- (item) =>
73
- buildInfo.watchFileSet.has(item) ||
74
- PathUtils.isChildPath(item, path.resolve(pkgPath, "src")),
75
- ),
76
- );
77
-
78
- if (modifiedFileSet.size < 1) return;
79
-
80
- return { pkgPath, buildInfo: buildInfo, modifiedFileSet };
81
- })
82
- .filterExists();
83
- if (changedPkgInfos.length < 1) return;
84
-
85
- // 변경된 패키지들에 대한 change처리
86
- opt.onChange();
87
- const buildResults = await changedPkgInfos.parallelAsync(async (changedPkgInfo) => {
88
- // 처음
89
- if (!changedPkgInfo.buildInfo) {
90
- const pkgConf = opt.projConf.packages[path.basename(changedPkgInfo.pkgPath)]!;
91
-
92
- const buildWorker = new SdWorker<ISdBuildRunnerWorkerType>(
93
- import.meta.resolve("../workers/build-runner.worker"),
94
- {
95
- resourceLimits: {
96
- maxOldGenerationSizeMb: 2048,
97
- maxYoungGenerationSizeMb: 8,
98
- stackSizeMb: 2,
99
- },
100
- },
101
- );
102
- await buildWorker.run("initialize", [
103
- {
104
- options: {
105
- pkgPath: changedPkgInfo.pkgPath,
106
- scopePathSet,
107
- watch: {
108
- dev: !pkgConf.forceProductionMode,
109
- emitOnly: opt.emitOnly,
110
- noEmit: opt.noEmit,
111
- },
112
- },
113
- pkgConf,
114
- },
115
- ]);
116
-
117
- const result = await buildWorker.run("rebuild", []);
118
-
119
- this._buildInfoMap.set(changedPkgInfo.pkgPath, {
120
- buildWorker,
121
- watchFileSet: result.watchFileSet,
122
- });
123
-
124
- return {
125
- isFirst: true,
126
- pkgPath: changedPkgInfo.pkgPath,
127
- emitFileSet: result.emitFileSet,
128
- affectedFileSet: result.affectedFileSet,
129
-
130
- buildMessages: result.buildMessages,
131
- };
132
- }
133
- // changed
134
- else {
135
- const result = await changedPkgInfo.buildInfo.buildWorker.run("rebuild", [
136
- changedPkgInfo.modifiedFileSet,
137
- ]);
138
- changedPkgInfo.buildInfo.watchFileSet = result.watchFileSet;
139
-
140
- return {
141
- isFirst: false,
142
- pkgPath: changedPkgInfo.pkgPath,
143
- emitFileSet: result.emitFileSet,
144
- affectedFileSet: result.affectedFileSet,
145
-
146
- buildMessages: result.buildMessages,
147
- };
148
- }
149
- });
150
-
151
- if (!opt.noEmit) {
152
- // 서버 구성 및 재시작
153
- for (const buildResult of buildResults) {
154
- if (buildResult.buildMessages.some((item) => item.severity === "error")) continue;
155
-
156
- const pkgConf = opt.projConf.packages[path.basename(buildResult.pkgPath)]!;
157
- if (pkgConf.type === "server") {
158
- const serverName = path.basename(buildResult.pkgPath);
159
- this._logger.debug(`서버 '${serverName}' 재시작...`);
160
-
161
- const serverInfo = this._serverInfoMap.getOrCreate(serverName, {});
162
- const restartServerResult = await this._restartServerAsync(
163
- serverInfo.worker,
164
- buildResult.pkgPath,
165
- pkgConf,
166
- );
167
- serverInfo.worker = restartServerResult.worker;
168
- serverInfo.port = restartServerResult.port;
169
-
170
- /*await serverInfo.worker.run("addPathProxy", [
171
- "node_modules",
172
- path.resolve(process.cwd(), "node_modules"),
173
- ]);
174
- if (serverInfo.clientMap) {
175
- for (const [clientName, clientInfo] of serverInfo.clientMap.entries()) {
176
- await serverInfo.worker.run("addPathProxy", [clientName, clientInfo.path]);
177
- }
178
- }*/
179
- } else if (pkgConf.type === "client" && typeof pkgConf.server === "object") {
180
- const serverName = pkgConf.server.port.toString();
181
- this._logger.debug(`서버 '${serverName}' 재시작...`);
182
-
183
- const serverInfo = this._serverInfoMap.getOrCreate(serverName, {});
184
- const restartServerResult = await this._restartServerAsync(
185
- serverInfo.worker,
186
- buildResult.pkgPath,
187
- pkgConf.server.port,
188
- );
189
- serverInfo.worker = restartServerResult.worker;
190
- serverInfo.port = restartServerResult.port;
191
-
192
- /*await worker.run("addPathProxy", [
193
- "node_modules",
194
- path.resolve(process.cwd(), "node_modules"),
195
- ]);*/
196
- }
197
- }
198
-
199
- // 클라이언트 구성 및 변경 Reload
200
- for (const buildResult of buildResults) {
201
- if (buildResult.buildMessages.some((item) => item.severity === "error")) continue;
202
-
203
- const pkgConf = opt.projConf.packages[path.basename(buildResult.pkgPath)]!;
204
- if (pkgConf.type === "client") {
205
- const clientName = path.basename(buildResult.pkgPath);
206
- const serverKey =
207
- typeof pkgConf.server === "string"
208
- ? pkgConf.server
209
- : typeof pkgConf.server === "object"
210
- ? pkgConf.server.port.toString()
211
- : undefined;
212
- if (serverKey == null) continue;
213
-
214
- const serverInfo = this._serverInfoMap.get(serverKey);
215
- if (!serverInfo || !serverInfo.worker) continue;
216
-
217
- const distPath = path.resolve(buildResult.pkgPath, "dist");
218
- serverInfo.clientMap = serverInfo.clientMap ?? new Map();
219
- serverInfo.clientMap.set(clientName, {
220
- distPath,
221
- buildTypes: (pkgConf.builder ? Object.keys(pkgConf.builder) : ["web"]) as any,
222
- });
223
-
224
- if (buildResult.isFirst) continue;
225
-
226
- this._logger.debug(`클라이언트 '${clientName}' 새로고침...`);
227
- await serverInfo.worker.run("broadcastReload", [
228
- clientName,
229
- new Set(
230
- Array.from(buildResult.emitFileSet)
231
- .filter((item) => !item.endsWith(".map"))
232
- .map((item) =>
233
- path.relative(
234
- distPath,
235
- item.replace(/cordova[\\\/]/, "").replace(/electron[\\\/]/, ""),
236
- ),
237
- ),
238
- ),
239
- ]);
240
- }
241
- }
242
-
243
- // 서버 Proxy 설정
244
- for (const serverInfo of this._serverInfoMap.values()) {
245
- if (!serverInfo.worker) continue;
246
-
247
- await serverInfo.worker.run("setPathProxy", [
248
- {
249
- ...Array.from(serverInfo.clientMap?.entries() ?? []).toObject(
250
- (entry) => entry[0],
251
- (entry) => entry[1].distPath,
252
- ),
253
- node_modules: path.resolve(process.cwd(), "node_modules"),
254
- },
255
- ]);
256
- }
257
-
258
- // 접속주소 logging
259
- for (const serverName of this._serverInfoMap.keys()) {
260
- const serverInfo = this._serverInfoMap.get(serverName);
261
- const clientPaths: string[] = [];
262
- for (const [clientName, clientInfo] of serverInfo?.clientMap?.entries() ?? []) {
263
- for (const buildType of clientInfo.buildTypes) {
264
- if (buildType === "web") {
265
- clientPaths.push(`http://localhost:${serverInfo!.port}/${clientName}/`);
266
- } else {
267
- clientPaths.push(`http://localhost:${serverInfo!.port}/${clientName}/${buildType}`);
268
- }
269
- }
270
- }
271
-
272
- this._logger.info("클라이언트 개발 서버 접속 주소\n" + clientPaths.join("\n"));
273
- }
274
- }
275
-
276
- // 빌드 완료 이벤트
277
-
278
- for (const buildResult of buildResults) {
279
- this._resultCache.delete(buildResult.pkgPath);
280
- for (const affectedFilePath of buildResult.affectedFileSet) {
281
- this._resultCache.delete(affectedFilePath);
282
- }
283
- }
284
-
285
- for (const buildResult of buildResults) {
286
- for (const buildMessage of buildResult.buildMessages) {
287
- const cacheItem = this._resultCache.getOrCreate(
288
- buildMessage.filePath ?? buildResult.pkgPath,
289
- [],
290
- );
291
- cacheItem.push(buildMessage);
292
- }
293
- }
294
-
295
- opt.onComplete(Array.from(this._resultCache.values()).mapMany());
296
- });
297
- }
298
-
299
- static async buildAsync(opt: {
300
- allPkgPaths: TNormPath[];
301
- pkgPaths: TNormPath[];
302
- projConf: ISdProjectConfig;
303
- }) {
304
- const scopePathSet = await this._getScopePathSetAsync(
305
- opt.allPkgPaths,
306
- Object.keys(opt.projConf.localUpdates ?? {}),
307
- );
308
-
309
- const buildResults = await opt.pkgPaths.parallelAsync(async (pkgPath) => {
310
- const pkgConf = opt.projConf.packages[path.basename(pkgPath)]!;
311
-
312
- const worker = new SdWorker<ISdBuildRunnerWorkerType>(
313
- import.meta.resolve("../workers/build-runner.worker"),
314
- {
315
- resourceLimits: {
316
- maxOldGenerationSizeMb: 2048,
317
- maxYoungGenerationSizeMb: 8,
318
- stackSizeMb: 2,
319
- },
320
- },
321
- );
322
-
323
- await worker.run("initialize", [
324
- {
325
- options: { pkgPath, scopePathSet },
326
- pkgConf,
327
- },
328
- ]);
329
-
330
- const result = await worker.run("rebuild", []);
331
- await worker.killAsync();
332
- return {
333
- buildMessages: result.buildMessages,
334
- };
335
- });
336
-
337
- return buildResults.mapMany((item) => item.buildMessages);
338
- }
339
-
340
- private static async _getScopePathSetAsync(pkgPaths: TNormPath[], localUpdateGlobs: string[]) {
341
- const workspacePaths = pkgPaths.mapMany((item) => [
342
- path.resolve(item, "src"),
343
- path.resolve(item, "public"),
344
- path.resolve(item, "public-dev"),
345
- path.resolve(item, "scss"),
346
- ]);
347
- const localUpdatePaths = (
348
- await localUpdateGlobs.mapManyAsync(
349
- async (glob) => await FsUtils.globAsync(path.resolve(process.cwd(), "node_modules", glob)),
350
- )
351
- ).mapMany((dir) => [path.resolve(dir, "dist"), path.resolve(dir, "scss")]);
352
-
353
- return new Set([...workspacePaths, ...localUpdatePaths].map((item) => PathUtils.norm(item)));
354
- }
355
-
356
- private static async _restartServerAsync(
357
- prevWorker: SdWorker<IServerWorkerType> | undefined,
358
- pkgPath: string,
359
- pkgConfOrPort: ISdServerPackageConfig | number,
360
- ): Promise<{
361
- worker?: SdWorker<IServerWorkerType>;
362
- port?: number;
363
- }> {
364
- try {
365
- if (prevWorker) {
366
- await prevWorker.killAsync();
367
- }
368
-
369
- const npmConf = FsUtils.readJson(path.resolve(pkgPath, "package.json")) as INpmConfig;
370
-
371
- const worker = new SdWorker<IServerWorkerType>(
372
- import.meta.resolve("../workers/server.worker"),
373
- {
374
- env: {
375
- NODE_ENV: "development",
376
- TZ: "Asia/Seoul",
377
- SD_VERSION: npmConf.version,
378
- ...(typeof pkgConfOrPort === "number" ? {} : pkgConfOrPort.env),
379
- },
380
- resourceLimits: {
381
- maxOldGenerationSizeMb: 2048,
382
- maxYoungGenerationSizeMb: 8,
383
- stackSizeMb: 2,
384
- },
385
- },
386
- );
387
- const port = await worker.run("listen", [
388
- typeof pkgConfOrPort === "number" ? pkgConfOrPort : pkgPath,
389
- ]);
390
- this._logger.debug("서버가 시작되었습니다.");
391
-
392
- return { worker, port };
393
- } catch (err) {
394
- this._logger.error("서버 재시작 실패: ", err);
395
- return {};
396
- }
397
- }
398
- }
@@ -1,112 +0,0 @@
1
- import path from "path";
2
- import { FsUtils, HashUtils, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
3
- import { StringUtils } from "@simplysm/sd-core-common";
4
-
5
- export class SdCliNgRoutesFileGenerator {
6
- cachedHash?: string;
7
-
8
- async watchAsync(pkgPath: string, noLazyRoute?: boolean) {
9
- const routesFilePath = path.resolve(pkgPath, "src/routes.ts");
10
- this.cachedHash = FsUtils.exists(routesFilePath)
11
- ? HashUtils.get(await FsUtils.readFileAsync(routesFilePath))
12
- : undefined;
13
-
14
- const watcher = await SdFsWatcher.watchAsync([path.resolve(pkgPath, "src")], {
15
- ignored: [routesFilePath],
16
- });
17
- watcher.onChange({ delay: 50 }, async (changeInfos) => {
18
- if (changeInfos.some((item) => ["add", "addDir", "unlink", "unlinkDir"].includes(item.event)))
19
- await this.runAsync(pkgPath, noLazyRoute);
20
- });
21
-
22
- await this.runAsync(pkgPath, noLazyRoute);
23
- }
24
-
25
- async runAsync(pkgPath: string, noLazyRoute?: boolean) {
26
- const appDirPath = path.resolve(pkgPath, "src/app");
27
- const routesFilePath = path.resolve(pkgPath, "src/routes.ts");
28
-
29
- // 내부 파일들 import
30
- const result: TInfo = new Map();
31
- const filePaths = await FsUtils.globAsync(path.resolve(appDirPath, "**/*{P,.p}age.ts"));
32
- for (const filePath of filePaths.orderBy()) {
33
- const relModulePath = PathUtils.posix(path.relative(appDirPath, filePath)).slice(0, -3);
34
- const codes = relModulePath
35
- .replace(/\.page$/, "")
36
- .replace(/Page$/, "")
37
- .split("/");
38
- // .map((item) => StringUtil.toKebabCase(item));
39
-
40
- let cursorItem!: { relModulePath?: string; children: TInfo };
41
- let cursor = result;
42
-
43
- for (let i = 0; i < codes.length; i++) {
44
- if (i === codes.length - 2) continue; // 마지막 모음 폴더 무시.
45
- const code = codes[i];
46
- cursorItem = cursor.getOrCreate(StringUtils.toKebabCase(code), { children: new Map() });
47
- cursor = cursorItem.children;
48
- }
49
-
50
- cursorItem.relModulePath = relModulePath;
51
- }
52
-
53
- const imports: string[] = [];
54
- const fn = (currInfo: TInfo, indent: number): string => {
55
- const indentStr = new Array(indent).fill(" ").join("");
56
-
57
- let cont = "";
58
- for (const [key, val] of currInfo) {
59
- cont += indentStr + "{\n";
60
- cont += indentStr + ` path: "${key}",\n`;
61
- if (val.relModulePath != null) {
62
- if (noLazyRoute) {
63
- cont +=
64
- indentStr +
65
- ` component: ${StringUtils.toPascalCase(path.basename(val.relModulePath))},\n`;
66
- imports.push(
67
- `import { ${StringUtils.toPascalCase(path.basename(val.relModulePath))} } from "./app/${val.relModulePath}";`,
68
- );
69
- } else {
70
- cont +=
71
- indentStr +
72
- ` loadComponent: () => import("./app/${val.relModulePath}").then((m) => m.${StringUtils.toPascalCase(
73
- path.basename(val.relModulePath),
74
- )}),\n`;
75
- }
76
- }
77
- if (val.children.size > 0) {
78
- cont += indentStr + ` children: [\n`;
79
- cont += fn(val.children, indent + 4) + "\n";
80
- cont += indentStr + ` ]\n`;
81
- }
82
- cont += indentStr + "},\n";
83
- }
84
- return cont.trimEnd();
85
- };
86
-
87
- const routes = fn(result, 2);
88
-
89
- const content = `
90
- import { Routes } from "@angular/router";
91
- ${imports.join("\n")}
92
- export const routes: Routes = [
93
- ${routes}
94
- ];`.trim();
95
- const currHash = HashUtils.get(content);
96
- if (currHash !== this.cachedHash) {
97
- await FsUtils.writeFileAsync(routesFilePath, content);
98
- this.cachedHash = currHash;
99
- return { changed: true, filePath: routesFilePath, content };
100
- } else {
101
- return { changed: false, filePath: routesFilePath, content };
102
- }
103
- }
104
- }
105
-
106
- type TInfo = Map<
107
- string,
108
- {
109
- relModulePath?: string;
110
- children: TInfo;
111
- }
112
- >;
@@ -1,156 +0,0 @@
1
- import { FsUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
2
- import path from "path";
3
- import { SdBuildRunnerBase } from "../SdBuildRunnerBase";
4
- import { SdNgBundler } from "./SdNgBundler";
5
- import { SdCliCordova } from "../../entry/SdCliCordova";
6
- import { ISdBuildResult } from "../../types/build/ISdBuildResult";
7
- import { INpmConfig } from "../../types/common-config/INpmConfig";
8
- import { SdCliNgRoutesFileGenerator } from "./SdCliNgRoutesFileGenerator";
9
- import { SdCliElectron } from "../../entry/SdCliElectron";
10
- import { ISdClientPackageConfig } from "../../types/config/ISdProjectConfig";
11
- import { SdCliCapacitor } from "../../entry/SdCliCapacitor";
12
-
13
- export class SdClientBuildRunner extends SdBuildRunnerBase<"client"> {
14
- protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdClientBuildRunner"]);
15
-
16
- private _ngBundlers?: SdNgBundler[];
17
- private _cordova?: SdCliCordova;
18
- private _capacitor?: SdCliCapacitor
19
-
20
- protected override async _runAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
21
- // 최초 한번
22
- if (!modifiedFileSet) {
23
- if (!this._opt.watch?.noEmit) {
24
- // config
25
- this._debug("Generating '.config'...");
26
- const confDistPath = path.resolve(this._opt.pkgPath, "dist/.config.json");
27
- await FsUtils.writeFileAsync(
28
- confDistPath,
29
- JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2),
30
- );
31
-
32
- // cordova
33
- if (this._pkgConf.builder?.cordova) {
34
- this._debug("Preparing Cordova...");
35
- this._cordova = new SdCliCordova({
36
- pkgPath: this._opt.pkgPath,
37
- config: this._pkgConf.builder.cordova,
38
- });
39
- await this._cordova.initializeAsync();
40
- }
41
-
42
- // capacitor
43
- if (this._pkgConf.builder?.capacitor) {
44
- this._debug("Preparing Capacitor...");
45
- this._capacitor = new SdCliCapacitor({
46
- pkgPath: this._opt.pkgPath,
47
- config: this._pkgConf.builder.capacitor,
48
- });
49
- await this._capacitor.initializeAsync();
50
- }
51
-
52
- // routes
53
- const npmConf = (await FsUtils.readJsonAsync(
54
- path.resolve(this._opt.pkgPath, "package.json"),
55
- )) as INpmConfig;
56
- if ("@angular/router" in (npmConf.dependencies ?? {})) {
57
- if (this._opt.watch) {
58
- this._debug("Starting routes.ts generator (watch mode)...");
59
- await new SdCliNgRoutesFileGenerator().watchAsync(
60
- this._opt.pkgPath,
61
- this._pkgConf.noLazyRoute,
62
- );
63
- } else {
64
- this._debug(`Generating 'routes.ts'...`);
65
- await new SdCliNgRoutesFileGenerator().runAsync(
66
- this._opt.pkgPath,
67
- this._pkgConf.noLazyRoute,
68
- );
69
- }
70
- }
71
- }
72
-
73
- // ng
74
- this._debug(`Preparing build...`);
75
-
76
- const builderTypes = Object.keys(this._pkgConf.builder ?? { web: {} }) as (keyof NonNullable<
77
- ISdClientPackageConfig["builder"]
78
- >)[];
79
-
80
- this._ngBundlers = builderTypes.map(
81
- (builderType) =>
82
- new SdNgBundler(this._opt, {
83
- builderType: builderType,
84
- builderConfig: this._pkgConf.builder?.[builderType],
85
- env: this._pkgConf.env,
86
- }),
87
- );
88
- }
89
-
90
- if (modifiedFileSet) {
91
- for (const ngBundler of this._ngBundlers!) {
92
- ngBundler.markForChanges(Array.from(modifiedFileSet));
93
- }
94
- }
95
-
96
- if (this._opt.watch?.noEmit) {
97
- this._debug(`Building...`);
98
- const buildResults = await Promise.all(
99
- this._ngBundlers!.map((builder) => builder.bundleAsync()),
100
- );
101
- const watchFileSet = new Set(buildResults.mapMany((item) => Array.from(item.watchFileSet)));
102
- const affectedFileSet = new Set(
103
- buildResults.mapMany((item) => Array.from(item.affectedFileSet)),
104
- );
105
- const emitFileSet = new Set(buildResults.mapMany((item) => Array.from(item.emitFileSet)));
106
- const buildMessages = buildResults.mapMany((item) => item.buildMessages).distinct();
107
-
108
- this._debug(`Build completed`);
109
- return {
110
- buildMessages,
111
-
112
- watchFileSet,
113
- affectedFileSet,
114
- emitFileSet,
115
- };
116
- } else {
117
- this._debug(`Building...`);
118
- const buildResults = await Promise.all(
119
- this._ngBundlers!.map((builder) => builder.bundleAsync()),
120
- );
121
- const watchFileSet = new Set(buildResults.mapMany((item) => Array.from(item.watchFileSet)));
122
- const affectedFileSet = new Set(
123
- buildResults.mapMany((item) => Array.from(item.affectedFileSet)),
124
- );
125
- const emitFileSet = new Set(buildResults.mapMany((item) => Array.from(item.emitFileSet)));
126
- const buildMessages = buildResults.mapMany((item) => item.buildMessages).distinct();
127
-
128
- if (!this._opt.watch?.dev && this._cordova) {
129
- this._debug("Building Cordova...");
130
- await this._cordova.buildAsync(path.resolve(this._opt.pkgPath, "dist"));
131
- }
132
-
133
- if (!this._opt.watch?.dev && this._capacitor) {
134
- this._debug("Building Capacitor...");
135
- await this._capacitor.buildAsync(path.resolve(this._opt.pkgPath, "dist"));
136
- }
137
-
138
- if (!this._opt.watch?.dev && this._pkgConf.builder?.electron) {
139
- this._debug("Bulding Electron...");
140
- await SdCliElectron.buildAsync({
141
- pkgPath: this._opt.pkgPath,
142
- electronConfig: this._pkgConf.builder.electron,
143
- });
144
- }
145
-
146
- this._debug(`Build completed`);
147
- return {
148
- buildMessages,
149
-
150
- watchFileSet,
151
- affectedFileSet,
152
- emitFileSet,
153
- };
154
- }
155
- }
156
- }