@simplysm/sd-cli 13.0.99 → 14.0.1

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 (409) hide show
  1. package/dist/commands/build.js +29 -19
  2. package/dist/commands/build.js.map +1 -6
  3. package/dist/commands/check.d.ts +1 -0
  4. package/dist/commands/check.d.ts.map +1 -1
  5. package/dist/commands/check.js +130 -115
  6. package/dist/commands/check.js.map +1 -6
  7. package/dist/commands/dev.d.ts +6 -7
  8. package/dist/commands/dev.d.ts.map +1 -1
  9. package/dist/commands/dev.js +24 -14
  10. package/dist/commands/dev.js.map +1 -6
  11. package/dist/commands/lint.d.ts +1 -1
  12. package/dist/commands/lint.js +158 -116
  13. package/dist/commands/lint.js.map +1 -6
  14. package/dist/commands/publish.d.ts.map +1 -1
  15. package/dist/commands/publish.js +637 -510
  16. package/dist/commands/publish.js.map +1 -6
  17. package/dist/commands/replace-deps.js +12 -12
  18. package/dist/commands/replace-deps.js.map +1 -6
  19. package/dist/commands/typecheck.d.ts +5 -30
  20. package/dist/commands/typecheck.d.ts.map +1 -1
  21. package/dist/commands/typecheck.js +144 -207
  22. package/dist/commands/typecheck.js.map +1 -6
  23. package/dist/commands/watch.d.ts +6 -4
  24. package/dist/commands/watch.d.ts.map +1 -1
  25. package/dist/commands/watch.js +25 -16
  26. package/dist/commands/watch.js.map +1 -6
  27. package/dist/engines/NgtscEngine.d.ts +47 -0
  28. package/dist/engines/NgtscEngine.d.ts.map +1 -0
  29. package/dist/engines/NgtscEngine.js +151 -0
  30. package/dist/engines/NgtscEngine.js.map +1 -0
  31. package/dist/engines/ServerEsbuildEngine.d.ts +47 -0
  32. package/dist/engines/ServerEsbuildEngine.d.ts.map +1 -0
  33. package/dist/engines/ServerEsbuildEngine.js +159 -0
  34. package/dist/engines/ServerEsbuildEngine.js.map +1 -0
  35. package/dist/engines/TscEngine.d.ts +47 -0
  36. package/dist/engines/TscEngine.d.ts.map +1 -0
  37. package/dist/engines/TscEngine.js +153 -0
  38. package/dist/engines/TscEngine.js.map +1 -0
  39. package/dist/engines/ViteEngine.d.ts +49 -0
  40. package/dist/engines/ViteEngine.d.ts.map +1 -0
  41. package/dist/engines/ViteEngine.js +161 -0
  42. package/dist/engines/ViteEngine.js.map +1 -0
  43. package/dist/engines/index.d.ts +26 -0
  44. package/dist/engines/index.d.ts.map +1 -0
  45. package/dist/engines/index.js +30 -0
  46. package/dist/engines/index.js.map +1 -0
  47. package/dist/engines/types.d.ts +77 -0
  48. package/dist/engines/types.d.ts.map +1 -0
  49. package/dist/engines/types.js +2 -0
  50. package/dist/engines/types.js.map +1 -0
  51. package/dist/index.d.ts +0 -1
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +2 -2
  54. package/dist/index.js.map +1 -6
  55. package/dist/infra/ResultCollector.d.ts +1 -1
  56. package/dist/infra/ResultCollector.d.ts.map +1 -1
  57. package/dist/infra/ResultCollector.js +30 -27
  58. package/dist/infra/ResultCollector.js.map +1 -6
  59. package/dist/infra/SignalHandler.js +45 -42
  60. package/dist/infra/SignalHandler.js.map +1 -6
  61. package/dist/infra/WorkerManager.js +56 -53
  62. package/dist/infra/WorkerManager.js.map +1 -6
  63. package/dist/orchestrators/BuildOrchestrator.d.ts +33 -1
  64. package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
  65. package/dist/orchestrators/BuildOrchestrator.js +314 -309
  66. package/dist/orchestrators/BuildOrchestrator.js.map +1 -6
  67. package/dist/orchestrators/DevWatchOrchestrator.d.ts +60 -0
  68. package/dist/orchestrators/DevWatchOrchestrator.d.ts.map +1 -0
  69. package/dist/orchestrators/DevWatchOrchestrator.js +465 -0
  70. package/dist/orchestrators/DevWatchOrchestrator.js.map +1 -0
  71. package/dist/sd-cli-entry.d.ts.map +1 -1
  72. package/dist/sd-cli-entry.js +190 -266
  73. package/dist/sd-cli-entry.js.map +1 -6
  74. package/dist/sd-cli.js +77 -49
  75. package/dist/sd-cli.js.map +1 -6
  76. package/dist/sd-config.types.d.ts +2 -0
  77. package/dist/sd-config.types.d.ts.map +1 -1
  78. package/dist/sd-config.types.js +2 -1
  79. package/dist/sd-config.types.js.map +1 -6
  80. package/dist/utils/angular-build.d.ts +77 -0
  81. package/dist/utils/angular-build.d.ts.map +1 -0
  82. package/dist/utils/angular-build.js +84 -0
  83. package/dist/utils/angular-build.js.map +1 -0
  84. package/dist/utils/build-env.js +9 -9
  85. package/dist/utils/build-env.js.map +1 -6
  86. package/dist/utils/concurrency.d.ts +15 -0
  87. package/dist/utils/concurrency.d.ts.map +1 -0
  88. package/dist/utils/concurrency.js +38 -0
  89. package/dist/utils/concurrency.js.map +1 -0
  90. package/dist/utils/copy-public.js +104 -87
  91. package/dist/utils/copy-public.js.map +1 -6
  92. package/dist/utils/copy-src.js +49 -35
  93. package/dist/utils/copy-src.js.map +1 -6
  94. package/dist/utils/esbuild-config.d.ts +0 -29
  95. package/dist/utils/esbuild-config.d.ts.map +1 -1
  96. package/dist/utils/esbuild-config.js +151 -218
  97. package/dist/utils/esbuild-config.js.map +1 -6
  98. package/dist/utils/ngtsc-build-core.d.ts +49 -0
  99. package/dist/utils/ngtsc-build-core.d.ts.map +1 -0
  100. package/dist/utils/ngtsc-build-core.js +250 -0
  101. package/dist/utils/ngtsc-build-core.js.map +1 -0
  102. package/dist/utils/output-path-rewriter.d.ts +23 -0
  103. package/dist/utils/output-path-rewriter.d.ts.map +1 -0
  104. package/dist/utils/output-path-rewriter.js +74 -0
  105. package/dist/utils/output-path-rewriter.js.map +1 -0
  106. package/dist/utils/output-utils.js +55 -40
  107. package/dist/utils/output-utils.js.map +1 -6
  108. package/dist/utils/package-utils.d.ts +8 -0
  109. package/dist/utils/package-utils.d.ts.map +1 -1
  110. package/dist/utils/package-utils.js +103 -73
  111. package/dist/utils/package-utils.js.map +1 -6
  112. package/dist/utils/rebuild-manager.js +41 -44
  113. package/dist/utils/rebuild-manager.js.map +1 -6
  114. package/dist/utils/replace-deps.js +283 -184
  115. package/dist/utils/replace-deps.js.map +1 -6
  116. package/dist/utils/scss-compiler.d.ts +10 -0
  117. package/dist/utils/scss-compiler.d.ts.map +1 -0
  118. package/dist/utils/scss-compiler.js +36 -0
  119. package/dist/utils/scss-compiler.js.map +1 -0
  120. package/dist/utils/sd-config.js +29 -19
  121. package/dist/utils/sd-config.js.map +1 -6
  122. package/dist/utils/tsc-build.d.ts +36 -0
  123. package/dist/utils/tsc-build.d.ts.map +1 -0
  124. package/dist/utils/tsc-build.js +130 -0
  125. package/dist/utils/tsc-build.js.map +1 -0
  126. package/dist/utils/tsconfig.d.ts +7 -26
  127. package/dist/utils/tsconfig.d.ts.map +1 -1
  128. package/dist/utils/tsconfig.js +39 -64
  129. package/dist/utils/tsconfig.js.map +1 -6
  130. package/dist/utils/typecheck-non-package.d.ts +18 -0
  131. package/dist/utils/typecheck-non-package.d.ts.map +1 -0
  132. package/dist/utils/typecheck-non-package.js +64 -0
  133. package/dist/utils/typecheck-non-package.js.map +1 -0
  134. package/dist/utils/typecheck-serialization.js +58 -40
  135. package/dist/utils/typecheck-serialization.js.map +1 -6
  136. package/dist/utils/worker-events.js +48 -40
  137. package/dist/utils/worker-events.js.map +1 -6
  138. package/dist/utils/worker-utils.js +48 -28
  139. package/dist/utils/worker-utils.js.map +1 -6
  140. package/dist/vitest-plugin.d.ts +9 -0
  141. package/dist/vitest-plugin.d.ts.map +1 -0
  142. package/dist/vitest-plugin.js +85 -0
  143. package/dist/vitest-plugin.js.map +1 -0
  144. package/dist/workers/library-build.worker.d.ts +54 -0
  145. package/dist/workers/library-build.worker.d.ts.map +1 -0
  146. package/dist/workers/library-build.worker.js +97 -0
  147. package/dist/workers/library-build.worker.js.map +1 -0
  148. package/dist/workers/lint.worker.js +9 -6
  149. package/dist/workers/lint.worker.js.map +1 -6
  150. package/dist/workers/ngtsc-build.worker.d.ts +23 -0
  151. package/dist/workers/ngtsc-build.worker.d.ts.map +1 -0
  152. package/dist/workers/ngtsc-build.worker.js +98 -0
  153. package/dist/workers/ngtsc-build.worker.js.map +1 -0
  154. package/dist/workers/{server.worker.d.ts → server-build.worker.d.ts} +39 -29
  155. package/dist/workers/server-build.worker.d.ts.map +1 -0
  156. package/dist/workers/server-build.worker.js +399 -0
  157. package/dist/workers/server-build.worker.js.map +1 -0
  158. package/dist/workers/server-runtime.worker.d.ts +3 -2
  159. package/dist/workers/server-runtime.worker.d.ts.map +1 -1
  160. package/dist/workers/server-runtime.worker.js +100 -95
  161. package/dist/workers/server-runtime.worker.js.map +1 -6
  162. package/dist/workers/vite-build.worker.d.ts +56 -0
  163. package/dist/workers/vite-build.worker.d.ts.map +1 -0
  164. package/dist/workers/vite-build.worker.js +167 -0
  165. package/dist/workers/vite-build.worker.js.map +1 -0
  166. package/package.json +10 -16
  167. package/src/commands/check.ts +21 -3
  168. package/src/commands/dev.ts +10 -8
  169. package/src/commands/lint.ts +1 -1
  170. package/src/commands/publish.ts +4 -0
  171. package/src/commands/typecheck.ts +89 -256
  172. package/src/commands/watch.ts +9 -8
  173. package/src/engines/NgtscEngine.ts +190 -0
  174. package/src/engines/ServerEsbuildEngine.ts +195 -0
  175. package/src/engines/TscEngine.ts +189 -0
  176. package/src/engines/ViteEngine.ts +203 -0
  177. package/src/engines/index.ts +49 -0
  178. package/src/engines/types.ts +79 -0
  179. package/src/index.ts +0 -3
  180. package/src/infra/ResultCollector.ts +1 -1
  181. package/src/orchestrators/BuildOrchestrator.ts +87 -157
  182. package/src/orchestrators/DevWatchOrchestrator.ts +573 -0
  183. package/src/sd-cli-entry.ts +13 -116
  184. package/src/sd-config.types.ts +2 -0
  185. package/src/utils/angular-build.ts +157 -0
  186. package/src/utils/concurrency.ts +43 -0
  187. package/src/utils/esbuild-config.ts +1 -122
  188. package/src/utils/ngtsc-build-core.ts +379 -0
  189. package/src/utils/output-path-rewriter.ts +82 -0
  190. package/src/utils/package-utils.ts +20 -0
  191. package/src/utils/scss-compiler.ts +58 -0
  192. package/src/utils/tsc-build.ts +175 -0
  193. package/src/utils/tsconfig.ts +27 -95
  194. package/src/utils/typecheck-non-package.ts +87 -0
  195. package/src/vitest-plugin.ts +118 -0
  196. package/src/workers/library-build.worker.ts +153 -0
  197. package/src/workers/ngtsc-build.worker.ts +146 -0
  198. package/src/workers/server-build.worker.ts +565 -0
  199. package/src/workers/server-runtime.worker.ts +17 -26
  200. package/src/workers/vite-build.worker.ts +252 -0
  201. package/tests/commands/check.spec.ts +276 -0
  202. package/tests/commands/dev.spec.ts +53 -0
  203. package/tests/commands/lint.spec.ts +243 -0
  204. package/tests/commands/publish.spec.ts +1159 -0
  205. package/tests/commands/typecheck.spec.ts +294 -0
  206. package/tests/commands/watch.spec.ts +53 -0
  207. package/tests/engines/engine-selection.spec.ts +247 -0
  208. package/tests/engines/ngtsc-engine.spec.ts +274 -0
  209. package/tests/engines/server-esbuild-engine.spec.ts +256 -0
  210. package/tests/engines/tsc-engine.spec.ts +213 -0
  211. package/tests/engines/vite-engine.spec.ts +358 -0
  212. package/tests/infra/result-collector.spec.ts +46 -0
  213. package/tests/infra/signal-handler.spec.ts +32 -0
  214. package/tests/infra/worker-manager.spec.ts +63 -0
  215. package/tests/orchestrators/build-orchestrator.spec.ts +772 -0
  216. package/tests/orchestrators/dev-watch-orchestrator.spec.ts +1173 -0
  217. package/tests/sd-cli-entry.spec.ts +49 -0
  218. package/tests/utils/angular-build.spec.ts +251 -0
  219. package/tests/utils/build-env.spec.ts +33 -0
  220. package/tests/utils/concurrency.spec.ts +65 -0
  221. package/tests/utils/copy-src.spec.ts +144 -0
  222. package/tests/utils/esbuild-config.spec.ts +186 -0
  223. package/tests/utils/external-modules.spec.ts +161 -0
  224. package/tests/utils/ngtsc-scss-refactor.spec.ts +66 -0
  225. package/tests/utils/output-path-rewriter.spec.ts +165 -0
  226. package/tests/utils/output-utils.spec.ts +104 -0
  227. package/tests/utils/package-utils.spec.ts +52 -0
  228. package/tests/utils/rebuild-manager.spec.ts +30 -27
  229. package/tests/utils/replace-deps.spec.ts +69 -0
  230. package/tests/utils/scss-compiler.spec.ts +131 -0
  231. package/tests/utils/sd-config.spec.ts +77 -0
  232. package/tests/utils/tsc-build.spec.ts +358 -0
  233. package/tests/utils/tsconfig-angular.spec.ts +71 -0
  234. package/tests/utils/typecheck-non-package.spec.ts +120 -0
  235. package/tests/utils/worker-events.spec.ts +155 -0
  236. package/tests/utils/worker-utils.spec.ts +43 -0
  237. package/tests/vitest-plugin-cwd.spec.ts +68 -0
  238. package/tests/vitest-plugin.spec.ts +103 -0
  239. package/tests/workers/library-build-worker.spec.ts +258 -0
  240. package/tests/workers/ngtsc-build-worker.spec.ts +187 -0
  241. package/tests/workers/server-build-worker.spec.ts +566 -0
  242. package/tests/workers/server-runtime-worker.spec.ts +251 -0
  243. package/README.md +0 -295
  244. package/dist/builders/BaseBuilder.d.ts +0 -88
  245. package/dist/builders/BaseBuilder.d.ts.map +0 -1
  246. package/dist/builders/BaseBuilder.js +0 -142
  247. package/dist/builders/BaseBuilder.js.map +0 -6
  248. package/dist/builders/DtsBuilder.d.ts +0 -22
  249. package/dist/builders/DtsBuilder.d.ts.map +0 -1
  250. package/dist/builders/DtsBuilder.js +0 -72
  251. package/dist/builders/DtsBuilder.js.map +0 -6
  252. package/dist/builders/LibraryBuilder.d.ts +0 -22
  253. package/dist/builders/LibraryBuilder.d.ts.map +0 -1
  254. package/dist/builders/LibraryBuilder.js +0 -85
  255. package/dist/builders/LibraryBuilder.js.map +0 -6
  256. package/dist/builders/types.d.ts +0 -55
  257. package/dist/builders/types.d.ts.map +0 -1
  258. package/dist/builders/types.js +0 -1
  259. package/dist/builders/types.js.map +0 -6
  260. package/dist/capacitor/capacitor.d.ts +0 -151
  261. package/dist/capacitor/capacitor.d.ts.map +0 -1
  262. package/dist/capacitor/capacitor.js +0 -694
  263. package/dist/capacitor/capacitor.js.map +0 -6
  264. package/dist/commands/device.d.ts +0 -22
  265. package/dist/commands/device.d.ts.map +0 -1
  266. package/dist/commands/device.js +0 -98
  267. package/dist/commands/device.js.map +0 -6
  268. package/dist/commands/init.d.ts +0 -14
  269. package/dist/commands/init.d.ts.map +0 -1
  270. package/dist/commands/init.js +0 -72
  271. package/dist/commands/init.js.map +0 -6
  272. package/dist/electron/electron.d.ts +0 -84
  273. package/dist/electron/electron.d.ts.map +0 -1
  274. package/dist/electron/electron.js +0 -263
  275. package/dist/electron/electron.js.map +0 -6
  276. package/dist/orchestrators/DevOrchestrator.d.ts +0 -83
  277. package/dist/orchestrators/DevOrchestrator.d.ts.map +0 -1
  278. package/dist/orchestrators/DevOrchestrator.js +0 -540
  279. package/dist/orchestrators/DevOrchestrator.js.map +0 -6
  280. package/dist/orchestrators/WatchOrchestrator.d.ts +0 -57
  281. package/dist/orchestrators/WatchOrchestrator.d.ts.map +0 -1
  282. package/dist/orchestrators/WatchOrchestrator.js +0 -199
  283. package/dist/orchestrators/WatchOrchestrator.js.map +0 -6
  284. package/dist/utils/tailwind-config-deps.d.ts +0 -8
  285. package/dist/utils/tailwind-config-deps.d.ts.map +0 -1
  286. package/dist/utils/tailwind-config-deps.js +0 -82
  287. package/dist/utils/tailwind-config-deps.js.map +0 -6
  288. package/dist/utils/template.d.ts +0 -14
  289. package/dist/utils/template.d.ts.map +0 -1
  290. package/dist/utils/template.js +0 -33
  291. package/dist/utils/template.js.map +0 -6
  292. package/dist/utils/vite-config.d.ts +0 -35
  293. package/dist/utils/vite-config.d.ts.map +0 -1
  294. package/dist/utils/vite-config.js +0 -259
  295. package/dist/utils/vite-config.js.map +0 -6
  296. package/dist/workers/client.worker.d.ts +0 -83
  297. package/dist/workers/client.worker.d.ts.map +0 -1
  298. package/dist/workers/client.worker.js +0 -111
  299. package/dist/workers/client.worker.js.map +0 -6
  300. package/dist/workers/dts.worker.d.ts +0 -75
  301. package/dist/workers/dts.worker.d.ts.map +0 -1
  302. package/dist/workers/dts.worker.js +0 -270
  303. package/dist/workers/dts.worker.js.map +0 -6
  304. package/dist/workers/library.worker.d.ts +0 -75
  305. package/dist/workers/library.worker.d.ts.map +0 -1
  306. package/dist/workers/library.worker.js +0 -166
  307. package/dist/workers/library.worker.js.map +0 -6
  308. package/dist/workers/server.worker.d.ts.map +0 -1
  309. package/dist/workers/server.worker.js +0 -482
  310. package/dist/workers/server.worker.js.map +0 -6
  311. package/src/builders/BaseBuilder.ts +0 -218
  312. package/src/builders/DtsBuilder.ts +0 -92
  313. package/src/builders/LibraryBuilder.ts +0 -110
  314. package/src/builders/types.ts +0 -60
  315. package/src/capacitor/capacitor.ts +0 -931
  316. package/src/commands/device.ts +0 -140
  317. package/src/commands/init.ts +0 -113
  318. package/src/electron/electron.ts +0 -362
  319. package/src/orchestrators/DevOrchestrator.ts +0 -744
  320. package/src/orchestrators/WatchOrchestrator.ts +0 -277
  321. package/src/utils/tailwind-config-deps.ts +0 -98
  322. package/src/utils/template.ts +0 -56
  323. package/src/utils/vite-config.ts +0 -390
  324. package/src/workers/client.worker.ts +0 -250
  325. package/src/workers/dts.worker.ts +0 -453
  326. package/src/workers/library.worker.ts +0 -316
  327. package/src/workers/server.worker.ts +0 -734
  328. package/templates/init/.gitignore.hbs +0 -34
  329. package/templates/init/.npmrc.hbs +0 -1
  330. package/templates/init/.prettierignore +0 -1
  331. package/templates/init/.prettierrc.yaml +0 -12
  332. package/templates/init/eslint.config.ts +0 -15
  333. package/templates/init/mise.toml +0 -3
  334. package/templates/init/package.json.hbs +0 -32
  335. package/templates/init/packages/client-admin/index.html.hbs +0 -144
  336. package/templates/init/packages/client-admin/package.json.hbs +0 -27
  337. package/templates/init/packages/client-admin/public/assets/logo-landscape.png +0 -0
  338. package/templates/init/packages/client-admin/public/assets/logo.png +0 -0
  339. package/templates/init/packages/client-admin/public/favicon.ico +0 -0
  340. package/templates/init/packages/client-admin/src/App.tsx +0 -42
  341. package/templates/init/packages/client-admin/src/dev/DevDialog.tsx +0 -34
  342. package/templates/init/packages/client-admin/src/events/AuthChangeEvent.ts +0 -3
  343. package/templates/init/packages/client-admin/src/main.css +0 -4
  344. package/templates/init/packages/client-admin/src/main.tsx.hbs +0 -146
  345. package/templates/init/packages/client-admin/src/providers/AppServiceProvider.tsx.hbs +0 -103
  346. package/templates/init/packages/client-admin/src/providers/AppStructureProvider.tsx +0 -84
  347. package/templates/init/packages/client-admin/src/providers/AuthProvider.tsx.hbs +0 -96
  348. package/templates/init/packages/client-admin/src/providers/configureSharedData.ts.hbs +0 -67
  349. package/templates/init/packages/client-admin/src/views/auth/LoginView.tsx +0 -132
  350. package/templates/init/packages/client-admin/src/views/home/HomeView.tsx +0 -108
  351. package/templates/init/packages/client-admin/src/views/home/base/employee/EmployeeDetail.tsx.hbs +0 -243
  352. package/templates/init/packages/client-admin/src/views/home/base/employee/EmployeeSheet.tsx.hbs +0 -271
  353. package/templates/init/packages/client-admin/src/views/home/base/role-permission/RoleDetail.tsx.hbs +0 -146
  354. package/templates/init/packages/client-admin/src/views/home/base/role-permission/RolePermissionDetail.tsx.hbs +0 -121
  355. package/templates/init/packages/client-admin/src/views/home/base/role-permission/RolePermissionView.tsx +0 -52
  356. package/templates/init/packages/client-admin/src/views/home/base/role-permission/RoleSheet.tsx.hbs +0 -125
  357. package/templates/init/packages/client-admin/src/views/home/main/MainView.tsx.hbs +0 -13
  358. package/templates/init/packages/client-admin/src/views/home/my-info/MyInfoDetail.tsx.hbs +0 -241
  359. package/templates/init/packages/client-admin/src/views/home/system/system-log/SystemLogSheet.tsx.hbs +0 -169
  360. package/templates/init/packages/client-admin/src/views/not-found/NotFoundView.tsx +0 -15
  361. package/templates/init/packages/client-admin/tailwind.config.ts +0 -10
  362. package/templates/init/packages/db-main/package.json.hbs +0 -13
  363. package/templates/init/packages/db-main/src/MainDbContext.ts +0 -22
  364. package/templates/init/packages/db-main/src/dataLogExt.ts +0 -127
  365. package/templates/init/packages/db-main/src/index.ts +0 -14
  366. package/templates/init/packages/db-main/src/tables/base/Employee.ts +0 -24
  367. package/templates/init/packages/db-main/src/tables/base/EmployeeConfig.ts +0 -13
  368. package/templates/init/packages/db-main/src/tables/base/Role.ts +0 -9
  369. package/templates/init/packages/db-main/src/tables/base/RolePermission.ts +0 -13
  370. package/templates/init/packages/db-main/src/tables/system/_DataLog.ts +0 -19
  371. package/templates/init/packages/db-main/src/tables/system/_Log.ts +0 -16
  372. package/templates/init/packages/server/package.json.hbs +0 -20
  373. package/templates/init/packages/server/public-dev/dev//354/264/210/352/270/260/355/231/224.xlsx +0 -0
  374. package/templates/init/packages/server/src/index.ts +0 -4
  375. package/templates/init/packages/server/src/main.ts.hbs +0 -34
  376. package/templates/init/packages/server/src/services/AuthService.ts.hbs +0 -171
  377. package/templates/init/packages/server/src/services/DevService.ts.hbs +0 -94
  378. package/templates/init/packages/server/src/services/EmployeeService.ts.hbs +0 -122
  379. package/templates/init/packages/server/src/services/RoleService.ts.hbs +0 -59
  380. package/templates/init/pnpm-workspace.yaml +0 -15
  381. package/templates/init/sd.config.ts.hbs +0 -48
  382. package/templates/init/tsconfig.json.hbs +0 -39
  383. package/templates/init/vitest.config.ts +0 -36
  384. package/tests/capacitor-exclude.spec.ts +0 -78
  385. package/tests/capacitor.spec.ts +0 -49
  386. package/tests/copy-src.spec.ts +0 -50
  387. package/tests/electron-exclude.spec.ts +0 -61
  388. package/tests/get-compiler-options-for-package.spec.ts +0 -80
  389. package/tests/get-package-source-files.spec.ts +0 -139
  390. package/tests/get-types-from-package-json.spec.ts +0 -92
  391. package/tests/infra/ResultCollector.spec.ts +0 -30
  392. package/tests/infra/SignalHandler.spec.ts +0 -38
  393. package/tests/infra/WorkerManager.spec.ts +0 -63
  394. package/tests/load-ignore-patterns.spec.ts +0 -163
  395. package/tests/load-sd-config.spec.ts +0 -100
  396. package/tests/package-utils.spec.ts +0 -188
  397. package/tests/parse-root-tsconfig.spec.ts +0 -89
  398. package/tests/publish-config-narrowing.spec.ts +0 -20
  399. package/tests/replace-deps.spec.ts +0 -308
  400. package/tests/run-lint.spec.ts +0 -366
  401. package/tests/run-typecheck.spec.ts +0 -544
  402. package/tests/run-watch.spec.ts +0 -76
  403. package/tests/sd-cli.spec.ts +0 -265
  404. package/tests/sd-public-dev-plugin-mime.spec.ts +0 -19
  405. package/tests/tailwind-config-deps.spec.ts +0 -30
  406. package/tests/template.spec.ts +0 -70
  407. package/tests/vite-config-exclude.spec.ts +0 -35
  408. package/tests/vite-config-outdir.spec.ts +0 -38
  409. package/tests/write-changed-output-files.spec.ts +0 -97
@@ -1,453 +0,0 @@
1
- import path from "path";
2
- import ts from "typescript";
3
- import { createWorker, pathx } from "@simplysm/core-node";
4
- import { err as errNs } from "@simplysm/core-common";
5
- import { consola } from "consola";
6
- import {
7
- getCompilerOptionsForPackage,
8
- getPackageFiles,
9
- getPackageSourceFiles,
10
- parseRootTsconfig,
11
- type TypecheckEnv,
12
- } from "../utils/tsconfig";
13
- import { serializeDiagnostic, type SerializedDiagnostic } from "../utils/typecheck-serialization";
14
- import { createOnceGuard, registerCleanupHandlers, applyDebugLevel } from "../utils/worker-utils";
15
-
16
- applyDebugLevel();
17
-
18
- //#region Types
19
-
20
- /**
21
- * DTS watch start info
22
- */
23
- export interface DtsWatchInfo {
24
- name: string;
25
- cwd: string;
26
- pkgDir: string;
27
- env: TypecheckEnv;
28
- }
29
-
30
- /**
31
- * DTS one-time build info
32
- */
33
- export interface DtsBuildInfo {
34
- name: string;
35
- cwd: string;
36
- /** Package directory. If unspecified, non-package mode (typecheck all except packages/) */
37
- pkgDir?: string;
38
- /** Typecheck environment. Used together with pkgDir */
39
- env?: TypecheckEnv;
40
- /** true to generate .d.ts + typecheck, false to typecheck only (default: true) */
41
- emit?: boolean;
42
- }
43
-
44
- /**
45
- * DTS one-time build result
46
- */
47
- export interface DtsBuildResult {
48
- success: boolean;
49
- errors?: string[];
50
- diagnostics: SerializedDiagnostic[];
51
- errorCount: number;
52
- warningCount: number;
53
- }
54
-
55
- /**
56
- * Build event
57
- */
58
- export interface DtsBuildEvent {
59
- success: boolean;
60
- errors?: string[];
61
- }
62
-
63
- /**
64
- * Error event
65
- */
66
- export interface DtsErrorEvent {
67
- message: string;
68
- }
69
-
70
- /**
71
- * Worker event types
72
- */
73
- export interface DtsWorkerEvents extends Record<string, unknown> {
74
- buildStart: Record<string, never>;
75
- build: DtsBuildEvent;
76
- error: DtsErrorEvent;
77
- }
78
-
79
- //#endregion
80
-
81
- //#region Resource Management
82
-
83
- const logger = consola.withTag("sd:cli:dts:worker");
84
-
85
- /** tsc watch program (to be cleaned up) */
86
- let tscWatchProgram:
87
- | ts.WatchOfFilesAndCompilerOptions<ts.EmitAndSemanticDiagnosticsBuilderProgram>
88
- | undefined;
89
-
90
- /**
91
- * Clean up resources
92
- */
93
- function cleanup(): void {
94
- if (tscWatchProgram != null) {
95
- tscWatchProgram.close();
96
- tscWatchProgram = undefined;
97
- }
98
- }
99
-
100
- registerCleanupHandlers(cleanup, logger);
101
-
102
- //#endregion
103
-
104
- //#region DTS Output Path Rewriting
105
-
106
- /**
107
- * Adjust sources path in .d.ts.map file to new location
108
- */
109
- function adjustDtsMapSources(content: string, originalDir: string, newDir: string): string {
110
- if (originalDir === newDir) return content;
111
- try {
112
- const map = JSON.parse(content) as { sources?: string[] };
113
- if (Array.isArray(map.sources)) {
114
- map.sources = map.sources.map((source) => {
115
- const absoluteSource = path.resolve(originalDir, source);
116
- return path.relative(newDir, absoluteSource);
117
- });
118
- }
119
- return JSON.stringify(map);
120
- } catch {
121
- return content;
122
- }
123
- }
124
-
125
- /**
126
- * Create path rewriter function for DTS writeFile
127
- *
128
- * TypeScript includes other package sources referenced via path alias (@simplysm/*)
129
- * in rootDir calculation, so output is generated as nested structure dist/{pkgName}/src/...
130
- * The returned function rewrites only this package's .d.ts to flat structure (dist/...)
131
- * and ignores .d.ts from other packages.
132
- *
133
- * @returns (fileName, content) => [newPath, newContent] | null (null to skip writing)
134
- */
135
- function createDtsPathRewriter(
136
- pkgDir: string,
137
- ): (fileName: string, content: string) => [string, string] | null {
138
- const pkgName = path.basename(pkgDir);
139
- const distDir = pathx.norm(path.join(pkgDir, "dist"));
140
- const distPrefix = distDir + path.sep;
141
- // Nested structure prefix for this package: dist/{pkgName}/src/
142
- const ownNestedPrefix = pathx.norm(path.join(distDir, pkgName, "src")) + path.sep;
143
-
144
- return (fileName, content) => {
145
- fileName = pathx.norm(fileName);
146
-
147
- if (!fileName.startsWith(distPrefix)) return null;
148
-
149
- if (fileName.startsWith(ownNestedPrefix)) {
150
- // Rewrite nested path to flat: dist/{pkgName}/src/... → dist/...
151
- const flatPath = path.join(distDir, fileName.slice(ownNestedPrefix.length));
152
- if (fileName.endsWith(".d.ts.map")) {
153
- content = adjustDtsMapSources(content, path.dirname(fileName), path.dirname(flatPath));
154
- }
155
- return [flatPath, content];
156
- }
157
-
158
- // Nested output from other packages (dist/{otherPkg}/src/...) → ignore
159
- const relFromDist = fileName.slice(distPrefix.length);
160
- const segments = relFromDist.split(path.sep);
161
- if (segments.length >= 3 && segments[1] === "src") {
162
- return null;
163
- }
164
-
165
- // Already flat structure (package with no dependencies) → output as is
166
- return [fileName, content];
167
- };
168
- }
169
-
170
- //#endregion
171
-
172
- //#region build (one-time build)
173
-
174
- /**
175
- * DTS one-time build (typecheck + dts generation)
176
- */
177
- async function build(info: DtsBuildInfo): Promise<DtsBuildResult> {
178
- try {
179
- const parsedConfig = parseRootTsconfig(info.cwd);
180
-
181
- let rootFiles: string[];
182
- let baseOptions: ts.CompilerOptions;
183
- let diagnosticFilter: (d: ts.Diagnostic) => boolean;
184
- let tsBuildInfoFile: string;
185
-
186
- if (info.pkgDir != null && info.env != null) {
187
- // Package mode
188
- baseOptions = await getCompilerOptionsForPackage(parsedConfig.options, info.env, info.pkgDir);
189
-
190
- const shouldEmit = info.emit !== false;
191
- if (shouldEmit) {
192
- // Emit mode: only src (generate d.ts)
193
- rootFiles = getPackageSourceFiles(info.pkgDir, parsedConfig);
194
- const pkgSrcDir = path.join(info.pkgDir, "src");
195
- diagnosticFilter = (d) => d.file == null || pathx.isChildPath(d.file.fileName, pkgSrcDir);
196
- } else {
197
- // Typecheck mode: all package files (src + tests)
198
- rootFiles = getPackageFiles(info.pkgDir, parsedConfig);
199
- const pkgDir = info.pkgDir;
200
- diagnosticFilter = (d) => d.file == null || pathx.isChildPath(d.file.fileName, pkgDir);
201
- }
202
-
203
- tsBuildInfoFile = path.join(
204
- info.pkgDir,
205
- ".cache",
206
- shouldEmit ? "dts.tsbuildinfo" : `typecheck-${info.env}.tsbuildinfo`,
207
- );
208
- } else {
209
- // Non-package mode: root project files + package root config files typecheck
210
- const packagesDir = path.join(info.cwd, "packages");
211
- const isNonPackageFile = (fileName: string): boolean => {
212
- if (!pathx.isChildPath(fileName, packagesDir)) return true;
213
- // Include files directly in package root (config files): packages/{pkg}/file.ts
214
- const relative = path.relative(packagesDir, fileName);
215
- return relative.split(path.sep).length === 2;
216
- };
217
- rootFiles = parsedConfig.fileNames.filter(isNonPackageFile);
218
- baseOptions = parsedConfig.options;
219
- diagnosticFilter = (d) => d.file == null || isNonPackageFile(d.file.fileName);
220
- tsBuildInfoFile = path.join(info.cwd, ".cache", "typecheck-root.tsbuildinfo");
221
- }
222
-
223
- // Determine emit (default: true)
224
- const shouldEmit = info.emit !== false;
225
-
226
- const options: ts.CompilerOptions = {
227
- ...baseOptions,
228
- sourceMap: false,
229
- incremental: true,
230
- tsBuildInfoFile,
231
- };
232
-
233
- // Set related options based on emit
234
- if (shouldEmit && info.pkgDir != null) {
235
- // Generate dts + typecheck (package mode only)
236
- options.noEmit = false;
237
- options.emitDeclarationOnly = true;
238
- options.declaration = true;
239
- options.declarationMap = true;
240
- options.outDir = path.join(info.pkgDir, "dist");
241
- options.declarationDir = path.join(info.pkgDir, "dist");
242
- } else {
243
- // Typecheck only (no dts generation)
244
- options.noEmit = true;
245
- options.emitDeclarationOnly = false;
246
- options.declaration = false;
247
- options.declarationMap = false;
248
- // outDir/declarationDir not needed when not emitting
249
- }
250
-
251
- // Create incremental program
252
- const host = ts.createIncrementalCompilerHost(options);
253
-
254
- // Output only this package's .d.ts in flat path (prevent other packages' .d.ts generation + rewrite nested paths)
255
- if (shouldEmit && info.pkgDir != null) {
256
- const rewritePath = createDtsPathRewriter(info.pkgDir);
257
- const originalWriteFile = host.writeFile;
258
- host.writeFile = (fileName, content, writeByteOrderMark, onError, sourceFiles, data) => {
259
- const result = rewritePath(fileName, content);
260
- if (result != null) {
261
- originalWriteFile(result[0], result[1], writeByteOrderMark, onError, sourceFiles, data);
262
- }
263
- };
264
- }
265
-
266
- const program = ts.createIncrementalProgram({
267
- rootNames: rootFiles,
268
- options,
269
- host,
270
- });
271
-
272
- // Emit (must call even with noEmit to collect diagnostics)
273
- const emitResult = program.emit();
274
-
275
- // Collect diagnostics
276
- const allDiagnostics = [
277
- ...program.getConfigFileParsingDiagnostics(),
278
- ...program.getSyntacticDiagnostics(),
279
- ...program.getOptionsDiagnostics(),
280
- ...program.getGlobalDiagnostics(),
281
- ...program.getSemanticDiagnostics(),
282
- ...emitResult.diagnostics,
283
- ];
284
-
285
- // Collect errors only from this package's src folder (ignore other packages' errors)
286
- const filteredDiagnostics = allDiagnostics.filter(diagnosticFilter);
287
-
288
- const serializedDiagnostics = filteredDiagnostics.map(serializeDiagnostic);
289
- const errorCount = filteredDiagnostics.filter(
290
- (d) => d.category === ts.DiagnosticCategory.Error,
291
- ).length;
292
- const warningCount = filteredDiagnostics.filter(
293
- (d) => d.category === ts.DiagnosticCategory.Warning,
294
- ).length;
295
-
296
- // Error message string array (for backward compatibility)
297
- const errors = filteredDiagnostics
298
- .filter((d) => d.category === ts.DiagnosticCategory.Error)
299
- .map((d) => {
300
- const message = ts.flattenDiagnosticMessageText(d.messageText, "\n");
301
- if (d.file != null && d.start != null) {
302
- const { line, character } = d.file.getLineAndCharacterOfPosition(d.start);
303
- return `${d.file.fileName}:${line + 1}:${character + 1}: TS${d.code}: ${message}`;
304
- }
305
- return `TS${d.code}: ${message}`;
306
- });
307
-
308
- return {
309
- success: errorCount === 0,
310
- errors: errors.length > 0 ? errors : undefined,
311
- diagnostics: serializedDiagnostics,
312
- errorCount,
313
- warningCount,
314
- };
315
- } catch (err) {
316
- return {
317
- success: false,
318
- errors: [errNs.message(err)],
319
- diagnostics: [],
320
- errorCount: 1,
321
- warningCount: 0,
322
- };
323
- }
324
- }
325
-
326
- //#endregion
327
-
328
- //#region startWatch (watch mode)
329
-
330
- const guardStartWatch = createOnceGuard("startWatch");
331
-
332
- /**
333
- * Start DTS watch
334
- * @remarks This function should be called only once per Worker.
335
- * @throws If watch has already been started
336
- */
337
- async function startWatch(info: DtsWatchInfo): Promise<void> {
338
- guardStartWatch();
339
-
340
- try {
341
- const parsedConfig = parseRootTsconfig(info.cwd);
342
- const rootFiles = getPackageSourceFiles(info.pkgDir, parsedConfig);
343
- const baseOptions = await getCompilerOptionsForPackage(
344
- parsedConfig.options,
345
- info.env,
346
- info.pkgDir,
347
- );
348
-
349
- // This package path (for filtering)
350
- const pkgSrcDir = path.join(info.pkgDir, "src");
351
-
352
- const options: ts.CompilerOptions = {
353
- ...baseOptions,
354
- emitDeclarationOnly: true,
355
- declaration: true,
356
- declarationMap: true,
357
- outDir: path.join(info.pkgDir, "dist"),
358
- declarationDir: path.join(info.pkgDir, "dist"),
359
- sourceMap: false,
360
- noEmit: false,
361
- incremental: true,
362
- tsBuildInfoFile: path.join(info.pkgDir, ".cache", "dts.tsbuildinfo"),
363
- };
364
-
365
- let isFirstBuild = true;
366
- const collectedErrors: string[] = [];
367
-
368
- const reportDiagnostic: ts.DiagnosticReporter = (diagnostic) => {
369
- if (diagnostic.category === ts.DiagnosticCategory.Error) {
370
- // Collect errors only from this package's src folder (ignore other packages' errors)
371
- if (diagnostic.file != null && !pathx.isChildPath(diagnostic.file.fileName, pkgSrcDir)) {
372
- return;
373
- }
374
-
375
- const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
376
-
377
- // Include file location info if available (absolute path:line:column format - supports IDE links)
378
- if (diagnostic.file != null && diagnostic.start != null) {
379
- const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(
380
- diagnostic.start,
381
- );
382
- collectedErrors.push(
383
- `${diagnostic.file.fileName}:${line + 1}:${character + 1}: TS${diagnostic.code}: ${message}`,
384
- );
385
- } else {
386
- collectedErrors.push(`TS${diagnostic.code}: ${message}`);
387
- }
388
- }
389
- };
390
-
391
- // Output only this package's .d.ts in flat path (prevent other packages' .d.ts generation + rewrite nested paths)
392
- // TypeScript watch mode attempts to generate .d.ts for all imported modules.
393
- // In a monorepo, we prevent overwriting .d.ts from other packages and
394
- // rewrite nested paths (dist/{pkgName}/src/...) to flat paths (dist/...).
395
- const rewritePath = createDtsPathRewriter(info.pkgDir);
396
- const originalWriteFile = ts.sys.writeFile;
397
- const customSys: ts.System = {
398
- ...ts.sys,
399
- writeFile: (filePath, content, writeByteOrderMark) => {
400
- const result = rewritePath(filePath, content);
401
- if (result != null) {
402
- originalWriteFile(result[0], result[1], writeByteOrderMark);
403
- }
404
- },
405
- };
406
-
407
- const host = ts.createWatchCompilerHost(
408
- rootFiles,
409
- options,
410
- customSys,
411
- ts.createEmitAndSemanticDiagnosticsBuilderProgram,
412
- reportDiagnostic,
413
- () => {}, // watchStatusReporter - not used
414
- );
415
-
416
- const originalAfterProgramCreate = host.afterProgramCreate;
417
- host.afterProgramCreate = (program) => {
418
- originalAfterProgramCreate?.(program);
419
-
420
- if (!isFirstBuild) {
421
- sender.send("buildStart", {});
422
- }
423
-
424
- program.emit();
425
-
426
- sender.send("build", {
427
- success: collectedErrors.length === 0,
428
- errors: collectedErrors.length > 0 ? [...collectedErrors] : undefined,
429
- });
430
-
431
- collectedErrors.length = 0;
432
- isFirstBuild = false;
433
- };
434
-
435
- tscWatchProgram = ts.createWatchProgram(host);
436
- } catch (err) {
437
- sender.send("error", {
438
- message: errNs.message(err),
439
- });
440
- }
441
- }
442
-
443
- const sender = createWorker<
444
- { startWatch: typeof startWatch; build: typeof build },
445
- DtsWorkerEvents
446
- >({
447
- startWatch,
448
- build,
449
- });
450
-
451
- export default sender;
452
-
453
- //#endregion