@simplysm/sd-cli 12.13.21 → 12.13.35

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 (248) hide show
  1. package/dist/entry/{sd-cli-ai-command.js → SdCliAiCommand.js} +1 -1
  2. package/dist/entry/SdCliAiCommand.js.map +1 -0
  3. package/dist/entry/{sd-cli-cordova.d.ts → SdCliCordova.d.ts} +1 -1
  4. package/dist/entry/{sd-cli-cordova.js → SdCliCordova.js} +1 -1
  5. package/dist/entry/SdCliCordova.js.map +1 -0
  6. package/dist/entry/{sd-cli-electron.d.ts → SdCliElectron.d.ts} +1 -1
  7. package/dist/entry/{sd-cli-electron.js → SdCliElectron.js} +2 -2
  8. package/dist/entry/SdCliElectron.js.map +1 -0
  9. package/dist/entry/{sd-cli-local-update.js → SdCliLocalUpdate.js} +4 -4
  10. package/dist/entry/SdCliLocalUpdate.js.map +1 -0
  11. package/dist/entry/{sd-cli-postinstall.js → SdCliPostinstall.js} +1 -1
  12. package/dist/entry/SdCliPostinstall.js.map +1 -0
  13. package/dist/entry/{sd-cli-project.d.ts → SdCliProject.d.ts} +0 -1
  14. package/dist/entry/{sd-cli-project.js → SdCliProject.js} +41 -64
  15. package/dist/entry/SdCliProject.js.map +1 -0
  16. package/dist/fix/core/convert-symbol.js +22 -13
  17. package/dist/fix/core/convert-symbol.js.map +1 -1
  18. package/dist/fix/remove-unused-protected-readonly.js +7 -1
  19. package/dist/fix/remove-unused-protected-readonly.js.map +1 -1
  20. package/dist/pkg-builders/SdProjectBuildRunner.d.ts +18 -0
  21. package/dist/pkg-builders/SdProjectBuildRunner.js +235 -0
  22. package/dist/pkg-builders/SdProjectBuildRunner.js.map +1 -0
  23. package/dist/pkg-builders/client/{sd-cli-ng-routes.file-generator.js → SdCliNgRoutesFileGenerator.js} +1 -1
  24. package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js.map +1 -0
  25. package/dist/pkg-builders/client/SdClientBuildRunner.d.ts +8 -0
  26. package/dist/pkg-builders/client/{sd-client.build-runner.js → SdClientBuildRunner.js} +27 -31
  27. package/dist/pkg-builders/client/SdClientBuildRunner.js.map +1 -0
  28. package/dist/pkg-builders/client/{sd-ng.bundler.d.ts → SdNgBundler.d.ts} +6 -10
  29. package/dist/pkg-builders/client/{sd-ng.bundler.js → SdNgBundler.js} +12 -11
  30. package/dist/pkg-builders/client/SdNgBundler.js.map +1 -0
  31. package/dist/pkg-builders/client/{sd-ng.bundler-context.d.ts → SdNgBundlerContext.d.ts} +1 -1
  32. package/dist/pkg-builders/client/{sd-ng.bundler-context.js → SdNgBundlerContext.js} +3 -4
  33. package/dist/pkg-builders/client/SdNgBundlerContext.js.map +1 -0
  34. package/dist/pkg-builders/client/{sd-ng.plugin-creator.d.ts → createSdNgPlugin.d.ts} +4 -3
  35. package/dist/pkg-builders/client/{sd-ng.plugin-creator.js → createSdNgPlugin.js} +6 -86
  36. package/dist/pkg-builders/client/createSdNgPlugin.js.map +1 -0
  37. package/dist/pkg-builders/commons/{scope-path.d.ts → ScopePathSet.d.ts} +1 -1
  38. package/dist/pkg-builders/commons/{scope-path.js → ScopePathSet.js} +3 -3
  39. package/dist/pkg-builders/commons/ScopePathSet.js.map +1 -0
  40. package/dist/pkg-builders/commons/SdBuildRunnerBase.d.ts +20 -0
  41. package/dist/pkg-builders/commons/SdBuildRunnerBase.js +30 -0
  42. package/dist/pkg-builders/commons/SdBuildRunnerBase.js.map +1 -0
  43. package/dist/pkg-builders/lib/{sd-cli-db-context.file-generator.js → SdCliDbContextFileGenerator.js} +1 -1
  44. package/dist/pkg-builders/lib/SdCliDbContextFileGenerator.js.map +1 -0
  45. package/dist/pkg-builders/lib/{sd-cli-index.file-generator.js → SdCliIndexFileGenerator.js} +1 -1
  46. package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js.map +1 -0
  47. package/dist/pkg-builders/lib/SdJsLibBuildRunner.d.ts +8 -0
  48. package/dist/pkg-builders/lib/{sd-js-lib.build-runner.js → SdJsLibBuildRunner.js} +11 -16
  49. package/dist/pkg-builders/lib/SdJsLibBuildRunner.js.map +1 -0
  50. package/dist/pkg-builders/lib/SdTsLibBuildRunner.d.ts +8 -0
  51. package/dist/pkg-builders/lib/SdTsLibBuildRunner.js +36 -0
  52. package/dist/pkg-builders/lib/SdTsLibBuildRunner.js.map +1 -0
  53. package/dist/pkg-builders/lib/SdTsLibBuilder.d.ts +9 -0
  54. package/dist/pkg-builders/lib/{sd-ts-lib.builder.js → SdTsLibBuilder.js} +8 -8
  55. package/dist/pkg-builders/lib/SdTsLibBuilder.js.map +1 -0
  56. package/dist/pkg-builders/server/SdServerBuildRunner.d.ts +8 -0
  57. package/dist/pkg-builders/server/{sd-server.build-runner.js → SdServerBuildRunner.js} +30 -45
  58. package/dist/pkg-builders/server/SdServerBuildRunner.js.map +1 -0
  59. package/dist/pkg-builders/server/SdServerBundler.d.ts +18 -0
  60. package/dist/pkg-builders/server/{sd-server.bundler.js → SdServerBundler.js} +11 -11
  61. package/dist/pkg-builders/server/SdServerBundler.js.map +1 -0
  62. package/dist/pkg-builders/server/{sd-server.plugin-creator.d.ts → createSdServerPlugin.d.ts} +4 -3
  63. package/dist/pkg-builders/server/{sd-server.plugin-creator.js → createSdServerPlugin.js} +5 -4
  64. package/dist/pkg-builders/server/createSdServerPlugin.js.map +1 -0
  65. package/dist/sd-cli-entry.js +6 -12
  66. package/dist/sd-cli-entry.js.map +1 -1
  67. package/dist/sd-cli.js +1 -13
  68. package/dist/sd-cli.js.map +1 -1
  69. package/dist/ts-compiler/{sd-dependency-analyzer.d.ts → SdDepAnalyzer.d.ts} +5 -5
  70. package/dist/ts-compiler/{sd-dependency-analyzer.js → SdDepAnalyzer.js} +2 -4
  71. package/dist/ts-compiler/SdDepAnalyzer.js.map +1 -0
  72. package/dist/ts-compiler/{sd-dependency-cache.d.ts → SdDepCache.d.ts} +1 -11
  73. package/dist/ts-compiler/{sd-dependency-cache.js → SdDepCache.js} +2 -65
  74. package/dist/ts-compiler/SdDepCache.js.map +1 -0
  75. package/dist/ts-compiler/{sd-style-bundler.d.ts → SdStyleBundler.d.ts} +4 -4
  76. package/dist/ts-compiler/{sd-style-bundler.js → SdStyleBundler.js} +5 -5
  77. package/dist/ts-compiler/SdStyleBundler.js.map +1 -0
  78. package/dist/ts-compiler/{sd-ts-compiler.d.ts → SdTsCompiler.d.ts} +3 -2
  79. package/dist/ts-compiler/{sd-ts-compiler.js → SdTsCompiler.js} +33 -148
  80. package/dist/ts-compiler/SdTsCompiler.js.map +1 -0
  81. package/dist/types/{build.types.d.ts → build/ISdBuildMessage.d.ts} +0 -5
  82. package/dist/types/build/ISdBuildMessage.js +2 -0
  83. package/dist/types/build/ISdBuildMessage.js.map +1 -0
  84. package/dist/types/build/ISdBuildResult.d.ts +8 -0
  85. package/dist/types/build/ISdBuildResult.js +2 -0
  86. package/dist/types/build/ISdBuildResult.js.map +1 -0
  87. package/dist/types/build/ISdTsCompilerOptions.d.ts +13 -0
  88. package/dist/types/build/ISdTsCompilerOptions.js +2 -0
  89. package/dist/types/build/ISdTsCompilerOptions.js.map +1 -0
  90. package/dist/types/build/ISdTsCompilerResult.d.ts +14 -0
  91. package/dist/types/build/ISdTsCompilerResult.js +2 -0
  92. package/dist/types/build/ISdTsCompilerResult.js.map +1 -0
  93. package/dist/types/build/TStylesheetBundlingResult.d.ts +12 -0
  94. package/dist/types/build/TStylesheetBundlingResult.js +2 -0
  95. package/dist/types/build/TStylesheetBundlingResult.js.map +1 -0
  96. package/dist/types/{common-configs.types.d.ts → common-config/INpmConfig.d.ts} +0 -7
  97. package/dist/types/common-config/INpmConfig.js +2 -0
  98. package/dist/types/common-config/INpmConfig.js.map +1 -0
  99. package/dist/types/common-config/ITsConfig.d.ts +7 -0
  100. package/dist/types/common-config/ITsConfig.js +2 -0
  101. package/dist/types/common-config/ITsConfig.js.map +1 -0
  102. package/dist/types/{config.types.d.ts → config/ISdProjectConfig.d.ts} +0 -1
  103. package/dist/types/config/ISdProjectConfig.js +2 -0
  104. package/dist/types/config/ISdProjectConfig.js.map +1 -0
  105. package/dist/types/plugin/ISdCliNgPluginResultCache.d.ts +8 -0
  106. package/dist/types/plugin/ISdCliNgPluginResultCache.js +2 -0
  107. package/dist/types/plugin/ISdCliNgPluginResultCache.js.map +1 -0
  108. package/dist/types/{build-plugin.types.d.ts → plugin/ISdCliServerPluginResultCache.d.ts} +0 -6
  109. package/dist/types/plugin/ISdCliServerPluginResultCache.js +2 -0
  110. package/dist/types/plugin/ISdCliServerPluginResultCache.js.map +1 -0
  111. package/dist/types/worker/ISdBuildRunnerWorkerType.d.ts +23 -0
  112. package/dist/types/worker/ISdBuildRunnerWorkerType.js +2 -0
  113. package/dist/types/worker/ISdBuildRunnerWorkerType.js.map +1 -0
  114. package/dist/types/worker/IServerWorkerType.d.ts +17 -0
  115. package/dist/types/worker/IServerWorkerType.js +2 -0
  116. package/dist/types/worker/IServerWorkerType.js.map +1 -0
  117. package/dist/utils/{sd-cli-convert-message.utils.d.ts → SdCliConvertMessageUtils.d.ts} +1 -1
  118. package/dist/utils/{sd-cli-convert-message.utils.js → SdCliConvertMessageUtils.js} +4 -2
  119. package/dist/utils/SdCliConvertMessageUtils.js.map +1 -0
  120. package/dist/utils/{sd-cli-performance-time.js → SdCliPerformanceTimer.js} +1 -1
  121. package/dist/utils/SdCliPerformanceTimer.js.map +1 -0
  122. package/dist/{entry/utils → utils}/loadProjConfAsync.d.ts +1 -1
  123. package/dist/utils/loadProjConfAsync.js.map +1 -0
  124. package/dist/workers/build-runner.worker.js +13 -23
  125. package/dist/workers/build-runner.worker.js.map +1 -1
  126. package/dist/workers/server.worker.js +4 -4
  127. package/dist/workers/server.worker.js.map +1 -1
  128. package/package.json +12 -12
  129. package/src/entry/{sd-cli-cordova.ts → SdCliCordova.ts} +2 -2
  130. package/src/entry/{sd-cli-electron.ts → SdCliElectron.ts} +3 -3
  131. package/src/entry/{sd-cli-local-update.ts → SdCliLocalUpdate.ts} +6 -4
  132. package/src/entry/{sd-cli-project.ts → SdCliProject.ts} +55 -71
  133. package/src/fix/core/convert-symbol.ts +35 -16
  134. package/src/fix/remove-unused-protected-readonly.ts +7 -1
  135. package/src/pkg-builders/SdProjectBuildRunner.ts +354 -0
  136. package/src/pkg-builders/client/{sd-client.build-runner.ts → SdClientBuildRunner.ts} +31 -38
  137. package/src/pkg-builders/client/{sd-ng.bundler.ts → SdNgBundler.ts} +22 -31
  138. package/src/pkg-builders/client/{sd-ng.bundler-context.ts → SdNgBundlerContext.ts} +7 -9
  139. package/src/pkg-builders/client/{sd-ng.plugin-creator.ts → createSdNgPlugin.ts} +11 -94
  140. package/src/pkg-builders/commons/{scope-path.ts → ScopePathSet.ts} +3 -3
  141. package/src/pkg-builders/commons/SdBuildRunnerBase.ts +47 -0
  142. package/src/pkg-builders/lib/{sd-cli-db-context.file-generator.ts → SdCliDbContextFileGenerator.ts} +1 -1
  143. package/src/pkg-builders/lib/{sd-js-lib.build-runner.ts → SdJsLibBuildRunner.ts} +13 -32
  144. package/src/pkg-builders/lib/SdTsLibBuildRunner.ts +47 -0
  145. package/src/pkg-builders/lib/{sd-ts-lib.builder.ts → SdTsLibBuilder.ts} +12 -15
  146. package/src/pkg-builders/server/{sd-server.build-runner.ts → SdServerBuildRunner.ts} +25 -48
  147. package/src/pkg-builders/server/{sd-server.bundler.ts → SdServerBundler.ts} +26 -23
  148. package/src/pkg-builders/server/{sd-server.plugin-creator.ts → createSdServerPlugin.ts} +9 -7
  149. package/src/sd-cli-entry.ts +6 -12
  150. package/src/sd-cli.ts +1 -15
  151. package/src/ts-compiler/{sd-dependency-analyzer.ts → SdDepAnalyzer.ts} +5 -9
  152. package/src/ts-compiler/{sd-dependency-cache.ts → SdDepCache.ts} +1 -137
  153. package/src/ts-compiler/{sd-style-bundler.ts → SdStyleBundler.ts} +5 -5
  154. package/src/ts-compiler/{sd-ts-compiler.ts → SdTsCompiler.ts} +43 -175
  155. package/src/types/{build.types.ts → build/ISdBuildMessage.ts} +0 -6
  156. package/src/types/build/ISdBuildResult.ts +9 -0
  157. package/src/types/build/ISdTsCompilerOptions.ts +14 -0
  158. package/src/types/build/ISdTsCompilerResult.ts +12 -0
  159. package/src/types/build/TStylesheetBundlingResult.ts +15 -0
  160. package/src/types/{common-configs.types.ts → common-config/INpmConfig.ts} +0 -6
  161. package/src/types/common-config/ITsConfig.ts +5 -0
  162. package/src/types/{config.types.ts → config/ISdProjectConfig.ts} +0 -1
  163. package/src/types/plugin/ISdCliNgPluginResultCache.ts +9 -0
  164. package/src/types/{build-plugin.types.ts → plugin/ISdCliServerPluginResultCache.ts} +0 -7
  165. package/src/types/worker/ISdBuildRunnerWorkerType.ts +24 -0
  166. package/src/types/worker/IServerWorkerType.ts +8 -0
  167. package/src/utils/{sd-cli-convert-message.utils.ts → SdCliConvertMessageUtils.ts} +6 -3
  168. package/src/{entry/utils → utils}/loadProjConfAsync.ts +10 -6
  169. package/src/workers/build-runner.worker.ts +30 -29
  170. package/src/workers/server.worker.ts +7 -7
  171. package/tests/deps/sd-dependency-analyzer.spec.ts +38 -69
  172. package/tests/deps/sd-dependency-cache.spec.ts +3 -6
  173. package/dist/entry/sd-cli-ai-command.js.map +0 -1
  174. package/dist/entry/sd-cli-cordova.js.map +0 -1
  175. package/dist/entry/sd-cli-electron.js.map +0 -1
  176. package/dist/entry/sd-cli-local-update.js.map +0 -1
  177. package/dist/entry/sd-cli-postinstall.js.map +0 -1
  178. package/dist/entry/sd-cli-project.js.map +0 -1
  179. package/dist/entry/utils/loadProjConfAsync.js.map +0 -1
  180. package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js.map +0 -1
  181. package/dist/pkg-builders/client/sd-client.build-runner.d.ts +0 -7
  182. package/dist/pkg-builders/client/sd-client.build-runner.js.map +0 -1
  183. package/dist/pkg-builders/client/sd-ng.bundler-context.js.map +0 -1
  184. package/dist/pkg-builders/client/sd-ng.bundler.js.map +0 -1
  185. package/dist/pkg-builders/client/sd-ng.plugin-creator.js.map +0 -1
  186. package/dist/pkg-builders/commons/build-runner.base.d.ts +0 -29
  187. package/dist/pkg-builders/commons/build-runner.base.js +0 -114
  188. package/dist/pkg-builders/commons/build-runner.base.js.map +0 -1
  189. package/dist/pkg-builders/commons/scope-path.js.map +0 -1
  190. package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.js.map +0 -1
  191. package/dist/pkg-builders/lib/sd-cli-index.file-generator.js.map +0 -1
  192. package/dist/pkg-builders/lib/sd-js-lib.build-runner.d.ts +0 -8
  193. package/dist/pkg-builders/lib/sd-js-lib.build-runner.js.map +0 -1
  194. package/dist/pkg-builders/lib/sd-ts-lib.build-runner.d.ts +0 -7
  195. package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js +0 -41
  196. package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +0 -1
  197. package/dist/pkg-builders/lib/sd-ts-lib.builder.d.ts +0 -14
  198. package/dist/pkg-builders/lib/sd-ts-lib.builder.js.map +0 -1
  199. package/dist/pkg-builders/sd-multi.build-runner.d.ts +0 -14
  200. package/dist/pkg-builders/sd-multi.build-runner.js +0 -228
  201. package/dist/pkg-builders/sd-multi.build-runner.js.map +0 -1
  202. package/dist/pkg-builders/server/sd-server.build-runner.d.ts +0 -7
  203. package/dist/pkg-builders/server/sd-server.build-runner.js.map +0 -1
  204. package/dist/pkg-builders/server/sd-server.bundler.d.ts +0 -22
  205. package/dist/pkg-builders/server/sd-server.bundler.js.map +0 -1
  206. package/dist/pkg-builders/server/sd-server.plugin-creator.js.map +0 -1
  207. package/dist/ts-compiler/sd-dependency-analyzer.js.map +0 -1
  208. package/dist/ts-compiler/sd-dependency-cache.js.map +0 -1
  209. package/dist/ts-compiler/sd-style-bundler.js.map +0 -1
  210. package/dist/ts-compiler/sd-ts-compiler.js.map +0 -1
  211. package/dist/types/build-plugin.types.js +0 -2
  212. package/dist/types/build-plugin.types.js.map +0 -1
  213. package/dist/types/build-runner.types.d.ts +0 -10
  214. package/dist/types/build-runner.types.js +0 -2
  215. package/dist/types/build-runner.types.js.map +0 -1
  216. package/dist/types/build.types.js +0 -2
  217. package/dist/types/build.types.js.map +0 -1
  218. package/dist/types/common-configs.types.js +0 -2
  219. package/dist/types/common-configs.types.js.map +0 -1
  220. package/dist/types/config.types.js +0 -2
  221. package/dist/types/config.types.js.map +0 -1
  222. package/dist/types/ts-compiler.types.d.ts +0 -37
  223. package/dist/types/ts-compiler.types.js +0 -2
  224. package/dist/types/ts-compiler.types.js.map +0 -1
  225. package/dist/types/worker.types.d.ts +0 -67
  226. package/dist/types/worker.types.js +0 -2
  227. package/dist/types/worker.types.js.map +0 -1
  228. package/dist/utils/sd-cli-convert-message.utils.js.map +0 -1
  229. package/dist/utils/sd-cli-performance-time.js.map +0 -1
  230. package/src/pkg-builders/commons/build-runner.base.ts +0 -184
  231. package/src/pkg-builders/lib/sd-ts-lib.build-runner.ts +0 -57
  232. package/src/pkg-builders/sd-multi.build-runner.ts +0 -304
  233. package/src/types/build-runner.types.ts +0 -11
  234. package/src/types/ts-compiler.types.ts +0 -43
  235. package/src/types/worker.types.ts +0 -51
  236. /package/dist/entry/{sd-cli-ai-command.d.ts → SdCliAiCommand.d.ts} +0 -0
  237. /package/dist/entry/{sd-cli-local-update.d.ts → SdCliLocalUpdate.d.ts} +0 -0
  238. /package/dist/entry/{sd-cli-postinstall.d.ts → SdCliPostinstall.d.ts} +0 -0
  239. /package/dist/pkg-builders/client/{sd-cli-ng-routes.file-generator.d.ts → SdCliNgRoutesFileGenerator.d.ts} +0 -0
  240. /package/dist/pkg-builders/lib/{sd-cli-db-context.file-generator.d.ts → SdCliDbContextFileGenerator.d.ts} +0 -0
  241. /package/dist/pkg-builders/lib/{sd-cli-index.file-generator.d.ts → SdCliIndexFileGenerator.d.ts} +0 -0
  242. /package/dist/utils/{sd-cli-performance-time.d.ts → SdCliPerformanceTimer.d.ts} +0 -0
  243. /package/dist/{entry/utils → utils}/loadProjConfAsync.js +0 -0
  244. /package/src/entry/{sd-cli-ai-command.ts → SdCliAiCommand.ts} +0 -0
  245. /package/src/entry/{sd-cli-postinstall.ts → SdCliPostinstall.ts} +0 -0
  246. /package/src/pkg-builders/client/{sd-cli-ng-routes.file-generator.ts → SdCliNgRoutesFileGenerator.ts} +0 -0
  247. /package/src/pkg-builders/lib/{sd-cli-index.file-generator.ts → SdCliIndexFileGenerator.ts} +0 -0
  248. /package/src/utils/{sd-cli-performance-time.ts → SdCliPerformanceTimer.ts} +0 -0
@@ -0,0 +1,354 @@
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
+ static #logger = SdLogger.get(["simplysm", "sd-cli", "SdProjectBuildRunner"]);
18
+
19
+ static #buildInfoMap = new Map<
20
+ TNormPath,
21
+ {
22
+ buildWorker: SdWorker<ISdBuildRunnerWorkerType>;
23
+ watchFileSet: Set<TNormPath>;
24
+ }
25
+ >();
26
+
27
+ static #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
+ static #resultCache = new Map<TNormPath, ISdBuildMessage[]>();
43
+
44
+ static async watchAsync(opt: {
45
+ pkgPaths: TNormPath[];
46
+ projConf: ISdProjectConfig;
47
+ emitOnly: boolean;
48
+ noEmit: boolean;
49
+ onChange: () => void;
50
+ onComplete: (buildMessages: ISdBuildMessage[]) => void;
51
+ }) {
52
+ const scopePathSet = await this.#getScopePathSetAsync(
53
+ opt.pkgPaths,
54
+ Object.keys(opt.projConf.localUpdates ?? {}),
55
+ );
56
+
57
+ const watcher = SdFsWatcher.watch(Array.from(scopePathSet), {
58
+ ignoreInitial: false,
59
+ });
60
+ watcher.onChange({ delay: 300 }, async (changeInfos) => {
61
+ // 변경된 패키지 정보 구성
62
+ const changeFiles = changeInfos.map((item) => PathUtils.norm(item.path));
63
+ const changedPkgInfos = opt.pkgPaths
64
+ .map((pkgPath) => {
65
+ let buildInfo = this.#buildInfoMap.get(pkgPath);
66
+ if (!buildInfo) return { pkgPath };
67
+
68
+ const modifiedFileSet = new Set(
69
+ changeFiles.filter((item) => buildInfo.watchFileSet.has(item)),
70
+ );
71
+
72
+ if (modifiedFileSet.size < 1) return;
73
+
74
+ return { pkgPath, buildInfo: buildInfo, modifiedFileSet };
75
+ })
76
+ .filterExists();
77
+ if (changedPkgInfos.length < 1) return;
78
+
79
+ // 변경된 패키지들에 대한 change처리
80
+ opt.onChange();
81
+ const buildResults = await changedPkgInfos.parallelAsync(async (changedPkgInfo) => {
82
+ // 처음
83
+ if (!changedPkgInfo.buildInfo) {
84
+ const buildWorker = new SdWorker<ISdBuildRunnerWorkerType>(
85
+ import.meta.resolve("../workers/build-runner.worker"),
86
+ );
87
+ await buildWorker.run("initialize", [
88
+ {
89
+ pkgPath: changedPkgInfo.pkgPath,
90
+ projConf: opt.projConf,
91
+ scopePathSet: scopePathSet,
92
+
93
+ watch: true,
94
+ emitOnly: opt.emitOnly,
95
+ noEmit: opt.noEmit,
96
+ },
97
+ ]);
98
+
99
+ const result = await buildWorker.run("rebuild", []);
100
+
101
+ this.#buildInfoMap.set(changedPkgInfo.pkgPath, {
102
+ buildWorker,
103
+ watchFileSet: result.watchFileSet,
104
+ });
105
+
106
+ return {
107
+ isFirst: true,
108
+ pkgPath: changedPkgInfo.pkgPath,
109
+ emitFileSet: result.emitFileSet,
110
+ affectedFileSet: result.affectedFileSet,
111
+
112
+ buildMessages: result.buildMessages,
113
+ };
114
+ }
115
+ // changed
116
+ else {
117
+ const result = await changedPkgInfo.buildInfo.buildWorker.run("rebuild", [
118
+ changedPkgInfo.modifiedFileSet,
119
+ ]);
120
+ changedPkgInfo.buildInfo.watchFileSet = result.watchFileSet;
121
+
122
+ return {
123
+ isFirst: false,
124
+ pkgPath: changedPkgInfo.pkgPath,
125
+ emitFileSet: result.emitFileSet,
126
+ affectedFileSet: result.affectedFileSet,
127
+
128
+ buildMessages: result.buildMessages,
129
+ };
130
+ }
131
+ });
132
+
133
+ if (!opt.noEmit) {
134
+ // 서버 구성 및 재시작
135
+ for (const buildResult of buildResults) {
136
+ const pkgConf = opt.projConf.packages[path.basename(buildResult.pkgPath)]!;
137
+ if (pkgConf.type === "server") {
138
+ const serverName = path.basename(buildResult.pkgPath);
139
+ this.#logger.debug(`서버 '${serverName}' 재시작...`);
140
+
141
+ const serverInfo = this.#serverInfoMap.getOrCreate(serverName, {});
142
+ const restartServerResult = await this.#restartServerAsync(
143
+ serverInfo.worker,
144
+ buildResult.pkgPath,
145
+ pkgConf,
146
+ );
147
+ serverInfo.worker = restartServerResult.worker;
148
+ serverInfo.port = restartServerResult.port;
149
+
150
+ /*await serverInfo.worker.run("addPathProxy", [
151
+ "node_modules",
152
+ path.resolve(process.cwd(), "node_modules"),
153
+ ]);
154
+ if (serverInfo.clientMap) {
155
+ for (const [clientName, clientInfo] of serverInfo.clientMap.entries()) {
156
+ await serverInfo.worker.run("addPathProxy", [clientName, clientInfo.path]);
157
+ }
158
+ }*/
159
+ } else if (pkgConf.type === "client" && typeof pkgConf.server === "object") {
160
+ const serverName = pkgConf.server.port.toString();
161
+ this.#logger.debug(`서버 '${serverName}' 재시작...`);
162
+
163
+ const serverInfo = this.#serverInfoMap.getOrCreate(serverName, {});
164
+ const restartServerResult = await this.#restartServerAsync(
165
+ serverInfo.worker,
166
+ buildResult.pkgPath,
167
+ pkgConf.server.port,
168
+ );
169
+ serverInfo.worker = restartServerResult.worker;
170
+ serverInfo.port = restartServerResult.port;
171
+
172
+ /*await worker.run("addPathProxy", [
173
+ "node_modules",
174
+ path.resolve(process.cwd(), "node_modules"),
175
+ ]);*/
176
+ }
177
+ }
178
+
179
+ // 클라이언트 구성 및 변경 Reload
180
+ for (const buildResult of buildResults) {
181
+ const pkgConf = opt.projConf.packages[path.basename(buildResult.pkgPath)]!;
182
+ if (pkgConf.type === "client") {
183
+ const clientName = path.basename(buildResult.pkgPath);
184
+ const serverKey =
185
+ typeof pkgConf.server === "string"
186
+ ? pkgConf.server
187
+ : typeof pkgConf.server === "object"
188
+ ? pkgConf.server.port.toString()
189
+ : undefined;
190
+ if (serverKey == null) continue;
191
+
192
+ const serverInfo = this.#serverInfoMap.get(serverKey);
193
+ if (!serverInfo || !serverInfo.worker) continue;
194
+
195
+ const distPath = path.resolve(buildResult.pkgPath, "dist");
196
+ serverInfo.clientMap = serverInfo.clientMap ?? new Map();
197
+ serverInfo.clientMap.set(clientName, {
198
+ distPath,
199
+ buildTypes: (pkgConf.builder ? Object.keys(pkgConf.builder) : ["web"]) as any,
200
+ });
201
+
202
+ if (buildResult.isFirst) continue;
203
+
204
+ this.#logger.debug(`클라이언트 '${clientName}' 새로고침...`);
205
+ await serverInfo.worker.run("broadcastReload", [
206
+ clientName,
207
+ new Set(
208
+ Array.from(buildResult.emitFileSet)
209
+ .filter((item) => !item.endsWith(".map"))
210
+ .map((item) => path.relative(distPath, item)),
211
+ ),
212
+ ]);
213
+ }
214
+ }
215
+
216
+ // 서버 Proxy 설정
217
+ for (const serverInfo of this.#serverInfoMap.values()) {
218
+ if (!serverInfo.worker) continue;
219
+
220
+ await serverInfo.worker.run("setPathProxy", [
221
+ {
222
+ ...Array.from(serverInfo.clientMap?.entries() ?? []).toObject(
223
+ (entry) => entry[0],
224
+ (entry) => entry[1].distPath,
225
+ ),
226
+ node_modules: path.resolve(process.cwd(), "node_modules"),
227
+ },
228
+ ]);
229
+ }
230
+
231
+ // 접속주소 logging
232
+ for (const serverName of this.#serverInfoMap.keys()) {
233
+ const serverInfo = this.#serverInfoMap.get(serverName);
234
+ const clientPaths: string[] = [];
235
+ for (const [clientName, clientInfo] of serverInfo?.clientMap?.entries() ?? []) {
236
+ for (const buildType of clientInfo.buildTypes) {
237
+ if (buildType === "web") {
238
+ clientPaths.push(`http://localhost:${serverInfo!.port}/${clientName}/`);
239
+ } else {
240
+ clientPaths.push(`http://localhost:${serverInfo!.port}/${clientName}/${buildType}`);
241
+ }
242
+ }
243
+ }
244
+
245
+ this.#logger.info("클라이언트 개발 서버 접속 주소\n" + clientPaths.join("\n"));
246
+ }
247
+ }
248
+
249
+ // 빌드 완료 이벤트
250
+
251
+ for (const buildResult of buildResults) {
252
+ this.#resultCache.delete(buildResult.pkgPath);
253
+ for (const affectedFilePath of buildResult.affectedFileSet) {
254
+ this.#resultCache.delete(affectedFilePath);
255
+ }
256
+
257
+ for (const buildMessage of buildResult.buildMessages) {
258
+ if (
259
+ !buildMessage.filePath ||
260
+ PathUtils.isChildPath(buildMessage.filePath, buildResult.pkgPath)
261
+ ) {
262
+ const cacheItem = this.#resultCache.getOrCreate(
263
+ buildMessage.filePath ?? buildResult.pkgPath,
264
+ [],
265
+ );
266
+ cacheItem.push(buildMessage);
267
+ }
268
+ }
269
+ }
270
+
271
+ opt.onComplete(Array.from(this.#resultCache.values()).mapMany());
272
+ });
273
+ }
274
+
275
+ static async buildAsync(opt: { pkgPaths: TNormPath[]; projConf: ISdProjectConfig }) {
276
+ const scopePathSet = await this.#getScopePathSetAsync(
277
+ opt.pkgPaths,
278
+ Object.keys(opt.projConf.localUpdates ?? {}),
279
+ );
280
+
281
+ const buildResults = await opt.pkgPaths.parallelAsync(async (pkgPath) => {
282
+ const worker = new SdWorker<ISdBuildRunnerWorkerType>(
283
+ import.meta.resolve("../workers/build-runner.worker"),
284
+ );
285
+
286
+ await worker.run("initialize", [
287
+ {
288
+ pkgPath,
289
+ projConf: opt.projConf,
290
+ scopePathSet: scopePathSet,
291
+ },
292
+ ]);
293
+
294
+ const result = await worker.run("rebuild", []);
295
+ await worker.killAsync();
296
+ return {
297
+ buildMessages: result.buildMessages,
298
+ };
299
+ });
300
+
301
+ return buildResults.mapMany((item) => item.buildMessages);
302
+ }
303
+
304
+ static async #getScopePathSetAsync(pkgPaths: TNormPath[], localUpdateGlobs: string[]) {
305
+ const workspacePaths = pkgPaths.mapMany((item) => [
306
+ path.resolve(item, "src"),
307
+ path.resolve(item, "public"),
308
+ path.resolve(item, "public-dev"),
309
+ ]);
310
+ const localUpdatePaths = (
311
+ await localUpdateGlobs.mapManyAsync(
312
+ async (key) => await FsUtils.globAsync(path.resolve(process.cwd(), "node_modules", key)),
313
+ )
314
+ ).mapMany((key) => [
315
+ path.resolve(process.cwd(), "node_modules", key, "dist"),
316
+ path.resolve(process.cwd(), "node_modules", key, "src/**/*.scss"),
317
+ ]);
318
+
319
+ return new Set([...workspacePaths, ...localUpdatePaths].map((item) => PathUtils.norm(item)));
320
+ }
321
+
322
+ static async #restartServerAsync(
323
+ prevWorker: SdWorker<IServerWorkerType> | undefined,
324
+ pkgPath: string,
325
+ pkgConfOrPort: ISdServerPackageConfig | number,
326
+ ): Promise<{
327
+ worker: SdWorker<IServerWorkerType>;
328
+ port: number;
329
+ }> {
330
+ if (prevWorker) {
331
+ await prevWorker.killAsync();
332
+ }
333
+
334
+ const npmConf = FsUtils.readJson(path.resolve(pkgPath, "package.json")) as INpmConfig;
335
+
336
+ const worker = new SdWorker<IServerWorkerType>(
337
+ import.meta.resolve("../workers/server.worker"),
338
+ {
339
+ env: {
340
+ NODE_ENV: "development",
341
+ TZ: "Asia/Seoul",
342
+ SD_VERSION: npmConf.version,
343
+ ...(typeof pkgConfOrPort === "number" ? {} : pkgConfOrPort.env),
344
+ },
345
+ },
346
+ );
347
+ const port = await worker.run("listen", [
348
+ typeof pkgConfOrPort === "number" ? pkgConfOrPort : pkgPath,
349
+ ]);
350
+ this.#logger.debug("서버가 시작되었습니다.");
351
+
352
+ return { worker, port };
353
+ }
354
+ }
@@ -1,27 +1,23 @@
1
1
  import { FsUtils, PathUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
2
2
  import path from "path";
3
- import { SdNgBundler } from "./sd-ng.bundler";
4
- import { SdCliCordova } from "../../entry/sd-cli-cordova";
5
- import { SdCliElectron } from "../../entry/sd-cli-electron";
6
- import { BuildRunnerBase, IBuildRunnerRunResult } from "../commons/build-runner.base";
7
- import { SdCliNgRoutesFileGenerator } from "./sd-cli-ng-routes.file-generator";
8
- import { INpmConfig } from "../../types/common-configs.types";
9
-
10
- export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
3
+ import { SdBuildRunnerBase } from "../commons/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
+
11
+ export class SdClientBuildRunner extends SdBuildRunnerBase<"client"> {
11
12
  protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdClientBuildRunner"]);
12
13
 
13
14
  #ngBundlers?: SdNgBundler[];
14
15
  #cordova?: SdCliCordova;
15
16
 
16
- protected override async _runAsync(
17
- dev: boolean,
18
- emitOnly: boolean,
19
- noEmit: boolean,
20
- modifiedFileSet?: Set<TNormPath>,
21
- ): Promise<IBuildRunnerRunResult> {
17
+ protected override async _runAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
22
18
  // 최초 한번
23
19
  if (!modifiedFileSet) {
24
- if (!noEmit) {
20
+ if (!this._noEmit) {
25
21
  // config
26
22
  this._debug("GEN .config...");
27
23
  const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
@@ -57,17 +53,18 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
57
53
  this.#ngBundlers = ngBundlerBuilderTypes.map(
58
54
  (ngBundlerBuilderType) =>
59
55
  new SdNgBundler({
60
- dev,
61
- emitOnly,
62
- noEmit,
56
+ watch: this._watch,
57
+ dev: this._dev,
58
+ emitOnly: this._emitOnly ?? false,
59
+ noEmit: this._noEmit ?? false,
63
60
  builderType: ngBundlerBuilderType,
64
61
  pkgPath: this._pkgPath,
65
62
  outputPath:
66
63
  ngBundlerBuilderType === "web"
67
64
  ? PathUtils.norm(this._pkgPath, "dist")
68
- : ngBundlerBuilderType === "electron" && !dev
65
+ : ngBundlerBuilderType === "electron" && !this._dev
69
66
  ? PathUtils.norm(this._pkgPath, ".electron/src")
70
- : ngBundlerBuilderType === "cordova" && !dev
67
+ : ngBundlerBuilderType === "cordova" && !this._dev
71
68
  ? PathUtils.norm(this._pkgPath, ".cordova/www")
72
69
  : PathUtils.norm(this._pkgPath, "dist", ngBundlerBuilderType),
73
70
  env: {
@@ -80,18 +77,18 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
80
77
  : [],
81
78
  cordovaConfig:
82
79
  ngBundlerBuilderType === "cordova" ? this._pkgConf.builder!.cordova : undefined,
83
- watchScopePathSet: this._watchScopePathSet,
80
+ scopePathSet: this._scopePathSet,
84
81
  }),
85
82
  );
86
83
  }
87
84
 
88
- if (noEmit) {
89
- if (modifiedFileSet) {
90
- for (const ngBundler of this.#ngBundlers!) {
91
- ngBundler.markForChanges(Array.from(modifiedFileSet));
92
- }
85
+ if (modifiedFileSet) {
86
+ for (const ngBundler of this.#ngBundlers!) {
87
+ ngBundler.markForChanges(Array.from(modifiedFileSet));
93
88
  }
89
+ }
94
90
 
91
+ if (this._noEmit) {
95
92
  this._debug(`BUILD...`);
96
93
  const buildResults = await Promise.all(
97
94
  this.#ngBundlers!.map((builder) => builder.bundleAsync()),
@@ -101,23 +98,18 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
101
98
  buildResults.mapMany((item) => Array.from(item.affectedFileSet)),
102
99
  );
103
100
  const emitFileSet = new Set(buildResults.mapMany((item) => Array.from(item.emitFileSet)));
104
- const results = buildResults.mapMany((item) => item.results).distinct();
101
+ const buildMessages = buildResults.mapMany((item) => item.buildMessages).distinct();
105
102
 
106
103
  this._debug(`빌드 완료`);
107
104
 
108
105
  return {
106
+ buildMessages,
107
+
109
108
  watchFileSet,
110
109
  affectedFileSet,
111
- buildMessages: results,
112
110
  emitFileSet,
113
111
  };
114
112
  } else {
115
- if (modifiedFileSet) {
116
- for (const ngBundler of this.#ngBundlers!) {
117
- ngBundler.markForChanges(Array.from(modifiedFileSet));
118
- }
119
- }
120
-
121
113
  this._debug(`BUILD...`);
122
114
  const buildResults = await Promise.all(
123
115
  this.#ngBundlers!.map((builder) => builder.bundleAsync()),
@@ -127,14 +119,14 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
127
119
  buildResults.mapMany((item) => Array.from(item.affectedFileSet)),
128
120
  );
129
121
  const emitFileSet = new Set(buildResults.mapMany((item) => Array.from(item.emitFileSet)));
130
- const results = buildResults.mapMany((item) => item.results).distinct();
122
+ const buildMessages = buildResults.mapMany((item) => item.buildMessages).distinct();
131
123
 
132
- if (!dev && this.#cordova) {
124
+ if (!this._dev && this.#cordova) {
133
125
  this._debug("CORDOVA BUILD...");
134
126
  await this.#cordova.buildAsync(path.resolve(this._pkgPath, "dist"));
135
127
  }
136
128
 
137
- if (!dev && this._pkgConf.builder?.electron) {
129
+ if (!this._dev && this._pkgConf.builder?.electron) {
138
130
  this._debug("ELECTRON BUILD...");
139
131
  await SdCliElectron.buildAsync({
140
132
  pkgPath: this._pkgPath,
@@ -145,9 +137,10 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
145
137
  this._debug(`빌드 완료`);
146
138
 
147
139
  return {
140
+ buildMessages,
141
+
148
142
  watchFileSet,
149
143
  affectedFileSet,
150
- buildMessages: results,
151
144
  emitFileSet,
152
145
  };
153
146
  }
@@ -5,7 +5,7 @@ import { fileURLToPath } from "url";
5
5
  import nodeStdLibBrowser from "node-stdlib-browser";
6
6
  import nodeStdLibBrowserPlugin from "node-stdlib-browser/helpers/esbuild/plugin";
7
7
  import browserslist from "browserslist";
8
- import { SdNgBundlerContext } from "./sd-ng.bundler-context";
8
+ import { SdNgBundlerContext } from "./SdNgBundlerContext";
9
9
  import { MemoryLoadResultCache } from "@angular/build/src/tools/esbuild/load-result-cache";
10
10
  import {
11
11
  convertOutputFile,
@@ -26,26 +26,20 @@ import {
26
26
  import { Entrypoint } from "@angular/build/src/utils/index-file/augment-index-html";
27
27
  import { CrossOrigin } from "@angular/build/src/builders/application/schema";
28
28
  import { augmentAppWithServiceWorkerEsbuild } from "@angular/build/src/utils/service-worker";
29
- import {
30
- createSourcemapIgnorelistPlugin
31
- } from "@angular/build/src/tools/esbuild/sourcemap-ignorelist-plugin";
32
- import {
33
- StylesheetPluginFactory
34
- } from "@angular/build/src/tools/esbuild/stylesheets/stylesheet-plugin-factory";
29
+ import { createSourcemapIgnorelistPlugin } from "@angular/build/src/tools/esbuild/sourcemap-ignorelist-plugin";
30
+ import { StylesheetPluginFactory } from "@angular/build/src/tools/esbuild/stylesheets/stylesheet-plugin-factory";
35
31
  import { SassStylesheetLanguage } from "@angular/build/src/tools/esbuild/stylesheets/sass-language";
36
32
  import { CssStylesheetLanguage } from "@angular/build/src/tools/esbuild/stylesheets/css-language";
37
- import {
38
- createCssResourcePlugin
39
- } from "@angular/build/src/tools/esbuild/stylesheets/css-resource-plugin";
33
+ import { createCssResourcePlugin } from "@angular/build/src/tools/esbuild/stylesheets/css-resource-plugin";
40
34
  import { resolveAssets } from "@angular/build/src/utils/resolve-assets";
41
- import { createSdNgPlugin } from "./sd-ng.plugin-creator";
42
- import { SdCliPerformanceTimer } from "../../utils/sd-cli-performance-time";
43
- import { INpmConfig } from "../../types/common-configs.types";
44
- import { ISdClientBuilderCordovaConfig } from "../../types/config.types";
45
- import { ISdCliNgPluginResultCache } from "../../types/build-plugin.types";
46
- import { ISdBuildMessage } from "../../types/build.types";
35
+ import { createSdNgPlugin } from "./createSdNgPlugin";
36
+ import { SdCliPerformanceTimer } from "../../utils/SdCliPerformanceTimer";
37
+ import { ISdClientBuilderCordovaConfig } from "../../types/config/ISdProjectConfig";
47
38
  import nodeModule from "module";
48
- import { ScopePathSet } from "../commons/scope-path";
39
+ import { ScopePathSet } from "../commons/ScopePathSet";
40
+ import { ISdCliNgPluginResultCache } from "../../types/plugin/ISdCliNgPluginResultCache";
41
+ import { INpmConfig } from "../../types/common-config/INpmConfig";
42
+ import { ISdBuildResult } from "../../types/build/ISdBuildResult";
49
43
 
50
44
  export class SdNgBundler {
51
45
  #logger = SdLogger.get(["simplysm", "sd-cli", "SdNgBundler"]);
@@ -72,6 +66,7 @@ export class SdNgBundler {
72
66
 
73
67
  constructor(
74
68
  private readonly _opt: {
69
+ watch: boolean;
75
70
  dev: boolean;
76
71
  emitOnly: boolean;
77
72
  noEmit: boolean;
@@ -81,7 +76,7 @@ export class SdNgBundler {
81
76
  env: Record<string, string> | undefined;
82
77
  external: string[];
83
78
  cordovaConfig: ISdClientBuilderCordovaConfig | undefined;
84
- watchScopePathSet: ScopePathSet;
79
+ scopePathSet: ScopePathSet;
85
80
  },
86
81
  ) {
87
82
  this.#pkgNpmConf = FsUtils.readJson(path.resolve(this._opt.pkgPath, "package.json"));
@@ -107,12 +102,7 @@ export class SdNgBundler {
107
102
  // this._sourceFileCache.invalidate(filePaths);
108
103
  }
109
104
 
110
- async bundleAsync(): Promise<{
111
- watchFileSet: Set<TNormPath>;
112
- affectedFileSet: Set<TNormPath>;
113
- results: ISdBuildMessage[];
114
- emitFileSet: Set<TNormPath>;
115
- }> {
105
+ async bundleAsync(): Promise<ISdBuildResult> {
116
106
  const perf = new SdCliPerformanceTimer("ng bundle");
117
107
 
118
108
  this.#debug(`get contexts...`);
@@ -134,13 +124,13 @@ export class SdNgBundler {
134
124
  });
135
125
 
136
126
  //-- results
137
- const results = bundlingResults.mapMany((bundlingResult) => bundlingResult.results);
127
+ const buildMessages = bundlingResults.mapMany((bundlingResult) => bundlingResult.results);
138
128
 
139
129
  if (this._opt.noEmit) {
140
130
  return {
141
131
  watchFileSet: this.#ngResultCache.watchFileSet!,
142
132
  affectedFileSet: this.#ngResultCache.affectedFileSet!,
143
- results,
133
+ buildMessages,
144
134
  emitFileSet: new Set<TNormPath>(),
145
135
  };
146
136
  } else {
@@ -173,7 +163,7 @@ export class SdNgBundler {
173
163
  await perf.run("create index.html", async () => {
174
164
  const genIndexHtmlResult = await this.#genIndexHtmlAsync(outputFiles, initialFiles);
175
165
  for (const warning of genIndexHtmlResult.warnings) {
176
- results.push({
166
+ buildMessages.push({
177
167
  filePath: undefined,
178
168
  line: undefined,
179
169
  char: undefined,
@@ -184,7 +174,7 @@ export class SdNgBundler {
184
174
  });
185
175
  }
186
176
  for (const error of genIndexHtmlResult.errors) {
187
- results.push({
177
+ buildMessages.push({
188
178
  filePath: undefined,
189
179
  line: undefined,
190
180
  char: undefined,
@@ -228,7 +218,7 @@ export class SdNgBundler {
228
218
  );
229
219
  assetFiles.push(...serviceWorkerResult.assetFiles);
230
220
  } catch (err) {
231
- results.push({
221
+ buildMessages.push({
232
222
  filePath: undefined,
233
223
  line: undefined,
234
224
  char: undefined,
@@ -280,7 +270,7 @@ export class SdNgBundler {
280
270
  PathUtils.norm(this.#indexHtmlFilePath),
281
271
  ]),
282
272
  affectedFileSet: this.#ngResultCache.affectedFileSet!,
283
- results,
273
+ buildMessages,
284
274
  emitFileSet: emitFileSet,
285
275
  };
286
276
  }
@@ -530,12 +520,13 @@ export class SdNgBundler {
530
520
  createSourcemapIgnorelistPlugin(),
531
521
  createSdNgPlugin({
532
522
  modifiedFileSet: this.#modifiedFileSet,
523
+ watch: this._opt.watch,
533
524
  dev: this._opt.dev,
534
525
  emitOnly: this._opt.emitOnly,
535
526
  noEmit: this._opt.noEmit,
536
527
  pkgPath: this._opt.pkgPath,
537
528
  result: this.#ngResultCache,
538
- watchScopePathSet: this._opt.watchScopePathSet,
529
+ scopePathSet: this._opt.scopePathSet,
539
530
  }),
540
531
  ...(this._opt.builderType === "electron"
541
532
  ? []
@@ -1,7 +1,7 @@
1
1
  import esbuild from "esbuild";
2
2
  import path from "path";
3
3
  import { SdLogger } from "@simplysm/sd-core-node";
4
- import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
4
+ import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
5
5
 
6
6
  // import { InitialFileRecord } from "@angular/build/src/tools/esbuild/bundler-context";
7
7
 
@@ -22,8 +22,7 @@ export class SdNgBundlerContext {
22
22
  constructor(
23
23
  private readonly _pkgPath: string,
24
24
  private readonly _esbuildOptions: esbuild.BuildOptions,
25
- ) {
26
- }
25
+ ) {}
27
26
 
28
27
  async bundleAsync() {
29
28
  if (this.#context == null) {
@@ -36,12 +35,10 @@ export class SdNgBundlerContext {
36
35
  this.#debug(`rebuild...`);
37
36
  esbuildResult = await this.#context.rebuild();
38
37
  this.#debug(`rebuild completed`);
39
- }
40
- catch (err) {
38
+ } catch (err) {
41
39
  if ("warnings" in err || "errors" in err) {
42
40
  esbuildResult = err;
43
- }
44
- else {
41
+ } else {
45
42
  throw err;
46
43
  }
47
44
  }
@@ -120,8 +117,9 @@ export class SdNgBundlerContext {
120
117
 
121
118
  #debug(...msg: any[]): void {
122
119
  this.#logger.debug(
123
- `[${path.basename(this._pkgPath)}] (${Object.keys(this._esbuildOptions.entryPoints as Record<string, any>)
124
- .join(", ")})`,
120
+ `[${path.basename(this._pkgPath)}] (${Object.keys(
121
+ this._esbuildOptions.entryPoints as Record<string, any>,
122
+ ).join(", ")})`,
125
123
  ...msg,
126
124
  );
127
125
  }