@simplysm/sd-cli 12.13.21 → 12.13.23

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 (237) hide show
  1. package/package.json +12 -12
  2. package/src/entry/{sd-cli-cordova.ts → SdCliCordova.ts} +2 -2
  3. package/src/entry/{sd-cli-electron.ts → SdCliElectron.ts} +3 -3
  4. package/src/entry/{sd-cli-local-update.ts → SdCliLocalUpdate.ts} +6 -4
  5. package/src/entry/{sd-cli-project.ts → SdCliProject.ts} +55 -71
  6. package/src/pkg-builders/SdProjectBuildRunner.ts +347 -0
  7. package/src/pkg-builders/client/{sd-client.build-runner.ts → SdClientBuildRunner.ts} +31 -38
  8. package/src/pkg-builders/client/{sd-ng.bundler.ts → SdNgBundler.ts} +22 -31
  9. package/src/pkg-builders/client/{sd-ng.bundler-context.ts → SdNgBundlerContext.ts} +7 -9
  10. package/src/pkg-builders/client/{sd-ng.plugin-creator.ts → createSdNgPlugin.ts} +11 -94
  11. package/src/pkg-builders/commons/{scope-path.ts → ScopePathSet.ts} +3 -3
  12. package/src/pkg-builders/commons/SdBuildRunnerBase.ts +47 -0
  13. package/src/pkg-builders/lib/{sd-cli-db-context.file-generator.ts → SdCliDbContextFileGenerator.ts} +1 -1
  14. package/src/pkg-builders/lib/{sd-js-lib.build-runner.ts → SdJsLibBuildRunner.ts} +13 -32
  15. package/src/pkg-builders/lib/SdTsLibBuildRunner.ts +47 -0
  16. package/src/pkg-builders/lib/{sd-ts-lib.builder.ts → SdTsLibBuilder.ts} +12 -14
  17. package/src/pkg-builders/server/{sd-server.build-runner.ts → SdServerBuildRunner.ts} +25 -48
  18. package/src/pkg-builders/server/{sd-server.bundler.ts → SdServerBundler.ts} +26 -23
  19. package/src/pkg-builders/server/{sd-server.plugin-creator.ts → createSdServerPlugin.ts} +9 -7
  20. package/src/sd-cli-entry.ts +6 -12
  21. package/src/sd-cli.ts +1 -15
  22. package/src/ts-compiler/{sd-dependency-analyzer.ts → SdDepAnalyzer.ts} +5 -9
  23. package/src/ts-compiler/{sd-dependency-cache.ts → SdDepCache.ts} +1 -137
  24. package/src/ts-compiler/{sd-style-bundler.ts → SdStyleBundler.ts} +5 -5
  25. package/src/ts-compiler/{sd-ts-compiler.ts → SdTsCompiler.ts} +17 -144
  26. package/src/types/{build.types.ts → build/ISdBuildMessage.ts} +0 -6
  27. package/src/types/build/ISdBuildResult.ts +9 -0
  28. package/src/types/build/ISdTsCompilerOptions.ts +15 -0
  29. package/src/types/build/ISdTsCompilerResult.ts +12 -0
  30. package/src/types/build/TStylesheetBundlingResult.ts +15 -0
  31. package/src/types/{common-configs.types.ts → common-config/INpmConfig.ts} +0 -6
  32. package/src/types/common-config/ITsConfig.ts +5 -0
  33. package/src/types/{config.types.ts → config/ISdProjectConfig.ts} +0 -1
  34. package/src/types/plugin/ISdCliNgPluginResultCache.ts +9 -0
  35. package/src/types/{build-plugin.types.ts → plugin/ISdCliServerPluginResultCache.ts} +0 -7
  36. package/src/types/worker/ISdBuildRunnerWorkerType.ts +24 -0
  37. package/src/types/worker/IServerWorkerType.ts +8 -0
  38. package/src/utils/{sd-cli-convert-message.utils.ts → SdCliConvertMessageUtils.ts} +6 -3
  39. package/src/{entry/utils → utils}/loadProjConfAsync.ts +10 -6
  40. package/src/workers/build-runner.worker.ts +30 -29
  41. package/src/workers/server.worker.ts +7 -7
  42. package/tests/deps/sd-dependency-analyzer.spec.ts +38 -69
  43. package/tests/deps/sd-dependency-cache.spec.ts +3 -6
  44. package/dist/entry/sd-cli-ai-command.d.ts +0 -3
  45. package/dist/entry/sd-cli-ai-command.js +0 -65
  46. package/dist/entry/sd-cli-ai-command.js.map +0 -1
  47. package/dist/entry/sd-cli-cordova.d.ts +0 -16
  48. package/dist/entry/sd-cli-cordova.js +0 -398
  49. package/dist/entry/sd-cli-cordova.js.map +0 -1
  50. package/dist/entry/sd-cli-electron.d.ts +0 -18
  51. package/dist/entry/sd-cli-electron.js +0 -129
  52. package/dist/entry/sd-cli-electron.js.map +0 -1
  53. package/dist/entry/sd-cli-local-update.d.ts +0 -11
  54. package/dist/entry/sd-cli-local-update.js +0 -84
  55. package/dist/entry/sd-cli-local-update.js.map +0 -1
  56. package/dist/entry/sd-cli-postinstall.d.ts +0 -3
  57. package/dist/entry/sd-cli-postinstall.js +0 -39
  58. package/dist/entry/sd-cli-postinstall.js.map +0 -1
  59. package/dist/entry/sd-cli-project.d.ts +0 -22
  60. package/dist/entry/sd-cli-project.js +0 -325
  61. package/dist/entry/sd-cli-project.js.map +0 -1
  62. package/dist/entry/utils/loadProjConfAsync.d.ts +0 -5
  63. package/dist/entry/utils/loadProjConfAsync.js +0 -8
  64. package/dist/entry/utils/loadProjConfAsync.js.map +0 -1
  65. package/dist/fix/convert-extends-sd-modal-base-to-interface.d.ts +0 -1
  66. package/dist/fix/convert-extends-sd-modal-base-to-interface.js +0 -289
  67. package/dist/fix/convert-extends-sd-modal-base-to-interface.js.map +0 -1
  68. package/dist/fix/convert-extends-sd-print-template-base-to-interface.d.ts +0 -1
  69. package/dist/fix/convert-extends-sd-print-template-base-to-interface.js +0 -179
  70. package/dist/fix/convert-extends-sd-print-template-base-to-interface.js.map +0 -1
  71. package/dist/fix/convert-flat-pages-to-flat-menus.d.ts +0 -1
  72. package/dist/fix/convert-flat-pages-to-flat-menus.js +0 -68
  73. package/dist/fix/convert-flat-pages-to-flat-menus.js.map +0 -1
  74. package/dist/fix/convert-get-menus-to-usable-menus.d.ts +0 -1
  75. package/dist/fix/convert-get-menus-to-usable-menus.js +0 -48
  76. package/dist/fix/convert-get-menus-to-usable-menus.js.map +0 -1
  77. package/dist/fix/convert-modal-show-params.d.ts +0 -1
  78. package/dist/fix/convert-modal-show-params.js +0 -29
  79. package/dist/fix/convert-modal-show-params.js.map +0 -1
  80. package/dist/fix/convert-print-params.d.ts +0 -1
  81. package/dist/fix/convert-print-params.js +0 -37
  82. package/dist/fix/convert-print-params.js.map +0 -1
  83. package/dist/fix/convert-private-to-hash.d.ts +0 -1
  84. package/dist/fix/convert-private-to-hash.js +0 -59
  85. package/dist/fix/convert-private-to-hash.js.map +0 -1
  86. package/dist/fix/convert-sd-angular-symbol-names.d.ts +0 -1
  87. package/dist/fix/convert-sd-angular-symbol-names.js +0 -23
  88. package/dist/fix/convert-sd-angular-symbol-names.js.map +0 -1
  89. package/dist/fix/convert-sd-icon-to-fa-icon.d.ts +0 -1
  90. package/dist/fix/convert-sd-icon-to-fa-icon.js +0 -80
  91. package/dist/fix/convert-sd-icon-to-fa-icon.js.map +0 -1
  92. package/dist/fix/convert-sd-sheet-bindings-safety.d.ts +0 -1
  93. package/dist/fix/convert-sd-sheet-bindings-safety.js +0 -57
  94. package/dist/fix/convert-sd-sheet-bindings-safety.js.map +0 -1
  95. package/dist/fix/convert-select-modal-button-to-select-button.d.ts +0 -1
  96. package/dist/fix/convert-select-modal-button-to-select-button.js +0 -64
  97. package/dist/fix/convert-select-modal-button-to-select-button.js.map +0 -1
  98. package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.d.ts +0 -1
  99. package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.js +0 -38
  100. package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.js.map +0 -1
  101. package/dist/fix/convert-to-use-perms-signal.d.ts +0 -1
  102. package/dist/fix/convert-to-use-perms-signal.js +0 -99
  103. package/dist/fix/convert-to-use-perms-signal.js.map +0 -1
  104. package/dist/fix/core/convert-symbol.d.ts +0 -1
  105. package/dist/fix/core/convert-symbol.js +0 -93
  106. package/dist/fix/core/convert-symbol.js.map +0 -1
  107. package/dist/fix/core/get-ts-morph-source-files.d.ts +0 -1
  108. package/dist/fix/core/get-ts-morph-source-files.js +0 -8
  109. package/dist/fix/core/get-ts-morph-source-files.js.map +0 -1
  110. package/dist/fix/core/remove-named-import.d.ts +0 -1
  111. package/dist/fix/core/remove-named-import.js +0 -14
  112. package/dist/fix/core/remove-named-import.js.map +0 -1
  113. package/dist/fix/core/remove-symbol.d.ts +0 -1
  114. package/dist/fix/core/remove-symbol.js +0 -76
  115. package/dist/fix/core/remove-symbol.js.map +0 -1
  116. package/dist/fix/remove-sd-angular-symbol-names.d.ts +0 -1
  117. package/dist/fix/remove-sd-angular-symbol-names.js +0 -9
  118. package/dist/fix/remove-sd-angular-symbol-names.js.map +0 -1
  119. package/dist/fix/remove-unused-imports.d.ts +0 -1
  120. package/dist/fix/remove-unused-imports.js +0 -42
  121. package/dist/fix/remove-unused-imports.js.map +0 -1
  122. package/dist/fix/remove-unused-injects.d.ts +0 -1
  123. package/dist/fix/remove-unused-injects.js +0 -38
  124. package/dist/fix/remove-unused-injects.js.map +0 -1
  125. package/dist/fix/remove-unused-protected-readonly.d.ts +0 -1
  126. package/dist/fix/remove-unused-protected-readonly.js +0 -52
  127. package/dist/fix/remove-unused-protected-readonly.js.map +0 -1
  128. package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.d.ts +0 -9
  129. package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js +0 -89
  130. package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js.map +0 -1
  131. package/dist/pkg-builders/client/sd-client.build-runner.d.ts +0 -7
  132. package/dist/pkg-builders/client/sd-client.build-runner.js +0 -119
  133. package/dist/pkg-builders/client/sd-client.build-runner.js.map +0 -1
  134. package/dist/pkg-builders/client/sd-ng.bundler-context.d.ts +0 -22
  135. package/dist/pkg-builders/client/sd-ng.bundler-context.js +0 -91
  136. package/dist/pkg-builders/client/sd-ng.bundler-context.js.map +0 -1
  137. package/dist/pkg-builders/client/sd-ng.bundler.d.ts +0 -27
  138. package/dist/pkg-builders/client/sd-ng.bundler.js +0 -489
  139. package/dist/pkg-builders/client/sd-ng.bundler.js.map +0 -1
  140. package/dist/pkg-builders/client/sd-ng.plugin-creator.d.ts +0 -13
  141. package/dist/pkg-builders/client/sd-ng.plugin-creator.js +0 -223
  142. package/dist/pkg-builders/client/sd-ng.plugin-creator.js.map +0 -1
  143. package/dist/pkg-builders/commons/build-runner.base.d.ts +0 -29
  144. package/dist/pkg-builders/commons/build-runner.base.js +0 -114
  145. package/dist/pkg-builders/commons/build-runner.base.js.map +0 -1
  146. package/dist/pkg-builders/commons/scope-path.d.ts +0 -7
  147. package/dist/pkg-builders/commons/scope-path.js +0 -14
  148. package/dist/pkg-builders/commons/scope-path.js.map +0 -1
  149. package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.d.ts +0 -9
  150. package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.js +0 -134
  151. package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.js.map +0 -1
  152. package/dist/pkg-builders/lib/sd-cli-index.file-generator.d.ts +0 -10
  153. package/dist/pkg-builders/lib/sd-cli-index.file-generator.js +0 -61
  154. package/dist/pkg-builders/lib/sd-cli-index.file-generator.js.map +0 -1
  155. package/dist/pkg-builders/lib/sd-js-lib.build-runner.d.ts +0 -8
  156. package/dist/pkg-builders/lib/sd-js-lib.build-runner.js +0 -50
  157. package/dist/pkg-builders/lib/sd-js-lib.build-runner.js.map +0 -1
  158. package/dist/pkg-builders/lib/sd-ts-lib.build-runner.d.ts +0 -7
  159. package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js +0 -41
  160. package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +0 -1
  161. package/dist/pkg-builders/lib/sd-ts-lib.builder.d.ts +0 -14
  162. package/dist/pkg-builders/lib/sd-ts-lib.builder.js +0 -65
  163. package/dist/pkg-builders/lib/sd-ts-lib.builder.js.map +0 -1
  164. package/dist/pkg-builders/sd-multi.build-runner.d.ts +0 -14
  165. package/dist/pkg-builders/sd-multi.build-runner.js +0 -228
  166. package/dist/pkg-builders/sd-multi.build-runner.js.map +0 -1
  167. package/dist/pkg-builders/server/sd-server.build-runner.d.ts +0 -7
  168. package/dist/pkg-builders/server/sd-server.build-runner.js +0 -264
  169. package/dist/pkg-builders/server/sd-server.build-runner.js.map +0 -1
  170. package/dist/pkg-builders/server/sd-server.bundler.d.ts +0 -22
  171. package/dist/pkg-builders/server/sd-server.bundler.js +0 -153
  172. package/dist/pkg-builders/server/sd-server.bundler.js.map +0 -1
  173. package/dist/pkg-builders/server/sd-server.plugin-creator.d.ts +0 -13
  174. package/dist/pkg-builders/server/sd-server.plugin-creator.js +0 -62
  175. package/dist/pkg-builders/server/sd-server.plugin-creator.js.map +0 -1
  176. package/dist/sd-cli-entry.d.ts +0 -2
  177. package/dist/sd-cli-entry.js +0 -263
  178. package/dist/sd-cli-entry.js.map +0 -1
  179. package/dist/sd-cli.d.ts +0 -2
  180. package/dist/sd-cli.js +0 -97
  181. package/dist/sd-cli.js.map +0 -1
  182. package/dist/ts-compiler/sd-dependency-analyzer.d.ts +0 -15
  183. package/dist/ts-compiler/sd-dependency-analyzer.js +0 -302
  184. package/dist/ts-compiler/sd-dependency-analyzer.js.map +0 -1
  185. package/dist/ts-compiler/sd-dependency-cache.d.ts +0 -43
  186. package/dist/ts-compiler/sd-dependency-cache.js +0 -310
  187. package/dist/ts-compiler/sd-dependency-cache.js.map +0 -1
  188. package/dist/ts-compiler/sd-style-bundler.d.ts +0 -16
  189. package/dist/ts-compiler/sd-style-bundler.js +0 -118
  190. package/dist/ts-compiler/sd-style-bundler.js.map +0 -1
  191. package/dist/ts-compiler/sd-ts-compiler.d.ts +0 -8
  192. package/dist/ts-compiler/sd-ts-compiler.js +0 -522
  193. package/dist/ts-compiler/sd-ts-compiler.js.map +0 -1
  194. package/dist/types/build-plugin.types.d.ts +0 -14
  195. package/dist/types/build-plugin.types.js +0 -2
  196. package/dist/types/build-plugin.types.js.map +0 -1
  197. package/dist/types/build-runner.types.d.ts +0 -10
  198. package/dist/types/build-runner.types.js +0 -2
  199. package/dist/types/build-runner.types.js.map +0 -1
  200. package/dist/types/build.types.d.ts +0 -15
  201. package/dist/types/build.types.js +0 -2
  202. package/dist/types/build.types.js.map +0 -1
  203. package/dist/types/common-configs.types.d.ts +0 -24
  204. package/dist/types/common-configs.types.js +0 -2
  205. package/dist/types/common-configs.types.js.map +0 -1
  206. package/dist/types/config.types.d.ts +0 -109
  207. package/dist/types/config.types.js +0 -2
  208. package/dist/types/config.types.js.map +0 -1
  209. package/dist/types/ts-compiler.types.d.ts +0 -37
  210. package/dist/types/ts-compiler.types.js +0 -2
  211. package/dist/types/ts-compiler.types.js.map +0 -1
  212. package/dist/types/worker.types.d.ts +0 -67
  213. package/dist/types/worker.types.js +0 -2
  214. package/dist/types/worker.types.js.map +0 -1
  215. package/dist/utils/sd-cli-convert-message.utils.d.ts +0 -21
  216. package/dist/utils/sd-cli-convert-message.utils.js +0 -137
  217. package/dist/utils/sd-cli-convert-message.utils.js.map +0 -1
  218. package/dist/utils/sd-cli-performance-time.d.ts +0 -9
  219. package/dist/utils/sd-cli-performance-time.js +0 -51
  220. package/dist/utils/sd-cli-performance-time.js.map +0 -1
  221. package/dist/workers/build-runner.worker.d.ts +0 -1
  222. package/dist/workers/build-runner.worker.js +0 -49
  223. package/dist/workers/build-runner.worker.js.map +0 -1
  224. package/dist/workers/server.worker.d.ts +0 -1
  225. package/dist/workers/server.worker.js +0 -50
  226. package/dist/workers/server.worker.js.map +0 -1
  227. package/src/pkg-builders/commons/build-runner.base.ts +0 -184
  228. package/src/pkg-builders/lib/sd-ts-lib.build-runner.ts +0 -57
  229. package/src/pkg-builders/sd-multi.build-runner.ts +0 -304
  230. package/src/types/build-runner.types.ts +0 -11
  231. package/src/types/ts-compiler.types.ts +0 -43
  232. package/src/types/worker.types.ts +0 -51
  233. /package/src/entry/{sd-cli-ai-command.ts → SdCliAiCommand.ts} +0 -0
  234. /package/src/entry/{sd-cli-postinstall.ts → SdCliPostinstall.ts} +0 -0
  235. /package/src/pkg-builders/client/{sd-cli-ng-routes.file-generator.ts → SdCliNgRoutesFileGenerator.ts} +0 -0
  236. /package/src/pkg-builders/lib/{sd-cli-index.file-generator.ts → SdCliIndexFileGenerator.ts} +0 -0
  237. /package/src/utils/{sd-cli-performance-time.ts → SdCliPerformanceTimer.ts} +0 -0
@@ -1,9 +1,9 @@
1
1
  import { PathUtils, TNormPath } from "@simplysm/sd-core-node";
2
- import { TStylesheetBundlingResult } from "../types/ts-compiler.types";
3
2
  import { ComponentStylesheetBundler } from "@angular/build/src/tools/esbuild/angular/component-stylesheets";
4
3
  import { transformSupportedBrowsersToTargets } from "@angular/build/src/tools/esbuild/utils";
5
4
  import browserslist from "browserslist";
6
- import { ScopePathSet } from "../pkg-builders/commons/scope-path";
5
+ import { ScopePathSet } from "../pkg-builders/commons/ScopePathSet";
6
+ import { TStylesheetBundlingResult } from "../types/build/TStylesheetBundlingResult";
7
7
 
8
8
  export class SdStyleBundler {
9
9
  #ngStyleBundler: ComponentStylesheetBundler;
@@ -14,7 +14,7 @@ export class SdStyleBundler {
14
14
  constructor(
15
15
  private readonly _pkgPath: TNormPath,
16
16
  private readonly _isDevMode: boolean,
17
- private readonly _watchScopePathSet: ScopePathSet,
17
+ private readonly _scopePathSet: ScopePathSet,
18
18
  ) {
19
19
  this.#ngStyleBundler = new ComponentStylesheetBundler(
20
20
  {
@@ -68,8 +68,8 @@ export class SdStyleBundler {
68
68
 
69
69
  for (const referencedFile of result.referencedFiles ?? []) {
70
70
  if (
71
- !this._watchScopePathSet.inScope(fileNPath) ||
72
- !this._watchScopePathSet.inScope(PathUtils.norm(referencedFile))
71
+ !this._scopePathSet.inScope(fileNPath) ||
72
+ !this._scopePathSet.inScope(PathUtils.norm(referencedFile))
73
73
  )
74
74
  continue;
75
75
 
@@ -5,14 +5,15 @@ import { StringUtils } from "@simplysm/sd-core-common";
5
5
  import { NgtscProgram, OptimizeFor } from "@angular/compiler-cli";
6
6
  import { AngularCompilerHost } from "@angular/build/src/tools/angular/angular-host";
7
7
  import { replaceBootstrap } from "@angular/build/src/tools/angular/transformers/jit-bootstrap-transformer";
8
- import { SdCliPerformanceTimer } from "../utils/sd-cli-performance-time";
9
- import { SdCliConvertMessageUtils } from "../utils/sd-cli-convert-message.utils";
10
- import { ISdTsCompilerResult, SdTsCompilerOptions } from "../types/ts-compiler.types";
8
+ import { SdCliPerformanceTimer } from "../utils/SdCliPerformanceTimer";
9
+ import { SdCliConvertMessageUtils } from "../utils/SdCliConvertMessageUtils";
11
10
  import { createWorkerTransformer } from "@angular/build/src/tools/angular/transformers/web-worker-transformer";
12
- import { SdDependencyCache } from "./sd-dependency-cache";
13
- import { SdDependencyAnalyzer } from "./sd-dependency-analyzer";
11
+ import { SdDepCache } from "./SdDepCache";
12
+ import { SdDepAnalyzer } from "./SdDepAnalyzer";
14
13
  import { FlatESLint } from "eslint/use-at-your-own-risk";
15
- import { SdStyleBundler } from "./sd-style-bundler";
14
+ import { SdStyleBundler } from "./SdStyleBundler";
15
+ import { ISdTsCompilerOptions } from "../types/build/ISdTsCompilerOptions";
16
+ import { ISdTsCompilerResult } from "../types/build/ISdTsCompilerResult";
16
17
 
17
18
  export class SdTsCompiler {
18
19
  #logger = SdLogger.get(["simplysm", "sd-cli", "SdTsCompiler"]);
@@ -26,7 +27,7 @@ export class SdTsCompiler {
26
27
 
27
28
  // 빌드정보 캐싱
28
29
  #cache = {
29
- dep: new SdDependencyCache(),
30
+ dep: new SdDepCache(),
30
31
  type: new WeakMap<ts.Node, ts.Type | undefined>(),
31
32
  prop: new WeakMap<ts.Type, Map<string, ts.Symbol | undefined>>(),
32
33
  declFiles: new WeakMap<ts.Symbol, TNormPath[]>(),
@@ -43,7 +44,7 @@ export class SdTsCompiler {
43
44
 
44
45
  #perf!: SdCliPerformanceTimer;
45
46
 
46
- constructor(private readonly _opt: SdTsCompilerOptions) {
47
+ constructor(private readonly _opt: ISdTsCompilerOptions) {
47
48
  this.#debug("초기화 중...");
48
49
 
49
50
  const tsconfigPath = path.resolve(this._opt.pkgPath, "tsconfig.json");
@@ -54,7 +55,7 @@ export class SdTsCompiler {
54
55
  this.#styleBundler = new SdStyleBundler(
55
56
  this._opt.pkgPath,
56
57
  this._opt.isDevMode,
57
- this._opt.watchScopePathSet,
58
+ this._opt.scopePathSet,
58
59
  );
59
60
  }
60
61
  }
@@ -171,23 +172,6 @@ export class SdTsCompiler {
171
172
  context.resourceFile != null ? PathUtils.norm(context.resourceFile) : undefined,
172
173
  );
173
174
 
174
- /*if (!styleBundleResult.cached && !StringUtils.isNullOrEmpty(styleBundleResult.contents)) {
175
- const relPath = path.relative(
176
- path.resolve(this._opt.pkgPath, "src"),
177
- context.containingFile,
178
- );
179
- const outAbsPath = PathUtils.norm(
180
- compilerOptions.outDir!,
181
- relPath.replace(/\.ts$/, ".css"),
182
- );
183
- const cache = this.#emittedFilesCacheMap.getOrCreate(
184
- PathUtils.norm(context.containingFile),
185
- [],
186
- );
187
- cache.remove((item) => item.outAbsPath === outAbsPath);
188
- cache.push({ outAbsPath, text: styleBundleResult.contents });
189
- }*/
190
-
191
175
  return StringUtils.isNullOrEmpty(styleBundleResult.contents)
192
176
  ? null
193
177
  : { content: styleBundleResult.contents };
@@ -240,7 +224,7 @@ export class SdTsCompiler {
240
224
 
241
225
  const tsconfig = this.#parseTsConfig();
242
226
 
243
- if (modifiedFileSet.size !== 0) {
227
+ if (modifiedFileSet.size !== 0 && this._opt.isWatchMode) {
244
228
  this.#debug(`캐시 무효화 및 초기화 중...`);
245
229
 
246
230
  // this._perf.run("캐시 무효화 및 초기화", () => {
@@ -313,17 +297,12 @@ export class SdTsCompiler {
313
297
  });
314
298
  }
315
299
 
316
- if (!this._opt.isEmitOnly) {
300
+ if (!this._opt.isEmitOnly && this._opt.isWatchMode) {
317
301
  this.#debug(`새 의존성 분석 중...`);
318
302
 
319
303
  this.#perf.run("새 의존성 분석", () => {
320
304
  // SdTsDependencyAnalyzer를 통해 의존성 분석 및 SdDepCache 업데이트
321
- SdDependencyAnalyzer.analyze(
322
- this.#program!,
323
- compilerHost,
324
- this._opt.watchScopePathSet,
325
- this.#cache,
326
- );
305
+ SdDepAnalyzer.analyze(this.#program!, compilerHost, this._opt.scopePathSet, this.#cache);
327
306
  });
328
307
 
329
308
  this.#debug(`새 의존성 분석(Angular) 중...`);
@@ -331,9 +310,9 @@ export class SdTsCompiler {
331
310
  // Angular 리소스 의존성 추가
332
311
  if (this.#ngProgram) {
333
312
  this.#perf.run("새 의존성 분석(Angular)", () => {
334
- SdDependencyAnalyzer.analyzeAngularResources(
313
+ SdDepAnalyzer.analyzeAngularResources(
335
314
  this.#ngProgram!,
336
- this._opt.watchScopePathSet,
315
+ this._opt.scopePathSet,
337
316
  this.#cache.dep,
338
317
  );
339
318
  });
@@ -341,13 +320,11 @@ export class SdTsCompiler {
341
320
  }
342
321
 
343
322
  const allFiles = this.#program!.getSourceFiles().map((item) => PathUtils.norm(item.fileName));
344
- const watchFileSet = new Set(
345
- allFiles.filter((item) => this._opt.watchScopePathSet.inScope(item)),
346
- );
323
+ const watchFileSet = new Set(allFiles.filter((item) => this._opt.scopePathSet.inScope(item)));
347
324
 
348
325
  let affectedFileSet: Set<TNormPath>;
349
326
  if (modifiedFileSet.size === 0) {
350
- affectedFileSet = new Set(allFiles);
327
+ affectedFileSet = new Set(allFiles.filter((item) => this._opt.scopePathSet.inScope(item)));
351
328
  } else {
352
329
  const affectedFileMap = this.#cache.dep.getAffectedFileMap(modifiedFileSet);
353
330
  this.#debug("영향받은 파일:", affectedFileMap);
@@ -459,8 +436,6 @@ export class SdTsCompiler {
459
436
  continue;
460
437
  }
461
438
 
462
- // this.#debug(`get diagnostics of file ${affectedFile}...`);
463
-
464
439
  this.#perf.run("개별 파일 진단 수집", () => {
465
440
  diagnostics.push(
466
441
  ...this.#program!.getSyntacticDiagnostics(affectedSourceFile),
@@ -507,8 +482,6 @@ export class SdTsCompiler {
507
482
  return relPath.replace(/\.ts$/, "").replaceAll("\\", "/") + ".js";
508
483
  }),
509
484
  );
510
-
511
- // (transformers.before ??= []).push(this.#createExternalizeComponentStylesTransformer());
512
485
  }
513
486
 
514
487
  this.#debug(`파일 출력 중...`);
@@ -595,106 +568,6 @@ export class SdTsCompiler {
595
568
  };
596
569
  }
597
570
 
598
- /*#createExternalizeComponentStylesTransformer() {
599
- const f = ts.factory;
600
-
601
- function upsertEnsureStyleHelper(sf: ts.SourceFile): ts.SourceFile {
602
- const importTarget = "./" + path.basename(sf.fileName).replace(/\.ts$/, ".css");
603
-
604
- // 이미 동일한 import가 있으면 스킵
605
- if (
606
- sf.statements.some(
607
- (s) =>
608
- ts.isImportDeclaration(s) &&
609
- ts.isStringLiteral(s.moduleSpecifier) &&
610
- s.moduleSpecifier.text === importTarget,
611
- )
612
- ) {
613
- return sf;
614
- }
615
-
616
- const importDecl = f.createImportDeclaration(
617
- undefined,
618
- undefined,
619
- f.createStringLiteral(importTarget),
620
- );
621
-
622
- return f.updateSourceFile(sf, [importDecl, ...sf.statements]);
623
- }
624
-
625
- const removeStyleProp = (node: ts.ClassDeclaration) => {
626
- const allDecorators = ts.getDecorators(node);
627
- if (!allDecorators || allDecorators.length === 0) return node;
628
-
629
- const decoratorsUpdated = allDecorators.map((dec) => {
630
- if (!ts.isCallExpression(dec.expression)) return dec;
631
- const call = dec.expression;
632
- if (!ts.isIdentifier(call.expression) || call.expression.text !== "Component") return dec;
633
- if (call.arguments.length !== 1) return dec;
634
- const arg = call.arguments[0];
635
- if (!ts.isObjectLiteralExpression(arg)) return dec;
636
-
637
- const filteredProps = arg.properties.filter((p) => {
638
- if (!ts.isPropertyAssignment(p)) return true;
639
- const name = p.name;
640
- const key = ts.isIdentifier(name)
641
- ? name.text
642
- : ts.isStringLiteralLike(name)
643
- ? name.text
644
- : undefined;
645
- return !(key === "styles" || key === "styleUrls");
646
- });
647
-
648
- const newArg = f.updateObjectLiteralExpression(arg, filteredProps);
649
- const newCall = f.updateCallExpression(call, call.expression, call.typeArguments, [newArg]);
650
- return f.updateDecorator(dec, newCall);
651
- });
652
-
653
- const existingModifiers = node.modifiers ?? [];
654
- const modifiersWithoutOldDecos = existingModifiers.filter((m) => !ts.isDecorator(m));
655
- const newModifiers: readonly ts.ModifierLike[] = [
656
- ...decoratorsUpdated,
657
- ...modifiersWithoutOldDecos,
658
- ];
659
-
660
- const newNode = f.updateClassDeclaration(
661
- node,
662
- newModifiers,
663
- node.name,
664
- node.typeParameters,
665
- node.heritageClauses,
666
- node.members,
667
- );
668
-
669
- return f.updateClassDeclaration(
670
- newNode,
671
- newNode.modifiers,
672
- newNode.name,
673
- newNode.typeParameters,
674
- newNode.heritageClauses,
675
- newNode.members,
676
- );
677
- };
678
-
679
- return (ctx: ts.TransformationContext) => {
680
- return (sf: ts.SourceFile) => {
681
- const has = this.#styleBundler!.getResultCache().get(PathUtils.norm(sf.fileName));
682
- if (!has) return sf;
683
-
684
- const realSf = upsertEnsureStyleHelper(sf);
685
-
686
- function visitor(node: ts.Node): ts.Node {
687
- if (ts.isClassDeclaration(node) && Boolean(ts.getDecorators(node)?.length)) {
688
- return removeStyleProp(node);
689
- }
690
- return ts.visitEachChild(node, visitor, ctx);
691
- }
692
-
693
- return ts.visitNode(realSf, visitor) as ts.SourceFile;
694
- };
695
- };
696
- }*/
697
-
698
571
  #convertOutputToReal(filePath: string, distPath: string, text: string) {
699
572
  let realFilePath = PathUtils.norm(filePath);
700
573
  let realText = text;
@@ -1,11 +1,5 @@
1
1
  import { TNormPath } from "@simplysm/sd-core-node";
2
2
 
3
- export interface ISdBuildRunnerResult {
4
- affectedFilePathSet: Set<TNormPath>;
5
- buildMessages: ISdBuildMessage[];
6
- emitFileSet: Set<TNormPath>;
7
- }
8
-
9
3
  export interface ISdBuildMessage {
10
4
  filePath: TNormPath | undefined;
11
5
  line: number | undefined;
@@ -0,0 +1,9 @@
1
+ import { TNormPath } from "@simplysm/sd-core-node";
2
+ import { ISdBuildMessage } from "./ISdBuildMessage";
3
+
4
+ export interface ISdBuildResult {
5
+ buildMessages: ISdBuildMessage[];
6
+ watchFileSet: Set<TNormPath>;
7
+ affectedFileSet: Set<TNormPath>;
8
+ emitFileSet: Set<TNormPath>;
9
+ }
@@ -0,0 +1,15 @@
1
+ import { TNormPath } from "@simplysm/sd-core-node";
2
+ import ts from "typescript";
3
+ import { ScopePathSet } from "../../pkg-builders/commons/ScopePathSet";
4
+
5
+ export interface ISdTsCompilerOptions {
6
+ pkgPath: TNormPath;
7
+ additionalOptions: ts.CompilerOptions;
8
+ isForBundle: boolean;
9
+ isWatchMode: boolean;
10
+ isDevMode: boolean;
11
+ isEmitOnly: boolean;
12
+ isNoEmit: boolean;
13
+ scopePathSet: ScopePathSet;
14
+ globalStyleFilePath?: TNormPath;
15
+ }
@@ -0,0 +1,12 @@
1
+ import { ISdBuildMessage } from "./ISdBuildMessage";
2
+ import { TNormPath } from "@simplysm/sd-core-node";
3
+ import { TStylesheetBundlingResult } from "./TStylesheetBundlingResult";
4
+
5
+ export interface ISdTsCompilerResult {
6
+ messages: ISdBuildMessage[];
7
+ stylesheetBundlingResultMap: Map<TNormPath, TStylesheetBundlingResult>;
8
+ emittedFilesCacheMap: Map<TNormPath, { outAbsPath?: TNormPath; text: string }[]>;
9
+ emitFileSet: Set<TNormPath>;
10
+ watchFileSet: Set<TNormPath>;
11
+ affectedFileSet: Set<TNormPath>;
12
+ }
@@ -0,0 +1,15 @@
1
+ import esbuild from "esbuild";
2
+
3
+ export type TStylesheetBundlingResult =
4
+ | {
5
+ errors: esbuild.PartialMessage[];
6
+ warnings: esbuild.PartialMessage[];
7
+ contents?: string;
8
+ }
9
+ | {
10
+ errors: undefined;
11
+ warnings: esbuild.PartialMessage[];
12
+ metafile: esbuild.Metafile;
13
+ outputFiles: esbuild.OutputFile[];
14
+ contents: string;
15
+ };
@@ -22,9 +22,3 @@ export interface INpmConfig {
22
22
 
23
23
  scripts?: Record<string, string>;
24
24
  }
25
-
26
- export interface ITsConfig {
27
- files?: string[];
28
- compilerOptions: { lib: string[] };
29
- angularCompilerOptions?: {};
30
- }
@@ -0,0 +1,5 @@
1
+ export interface ITsConfig {
2
+ files?: string[];
3
+ compilerOptions: { lib: string[] };
4
+ angularCompilerOptions?: {};
5
+ }
@@ -23,7 +23,6 @@ export interface ISdLibPackageConfig {
23
23
  publish?: "npm";
24
24
  polyfills?: string[];
25
25
  noGenIndex?: boolean;
26
- noBuild?: boolean;
27
26
  dbContext?: string;
28
27
  forceProductionMode?: boolean;
29
28
  }
@@ -0,0 +1,9 @@
1
+ import esbuild from "esbuild";
2
+ import { TNormPath } from "@simplysm/sd-core-node";
3
+
4
+ export interface ISdCliNgPluginResultCache {
5
+ watchFileSet?: Set<TNormPath>;
6
+ affectedFileSet?: Set<TNormPath>;
7
+ outputFiles?: esbuild.OutputFile[];
8
+ metafile?: esbuild.Metafile;
9
+ }
@@ -7,10 +7,3 @@ export interface ISdCliServerPluginResultCache {
7
7
  outputFiles?: esbuild.OutputFile[];
8
8
  metafile?: esbuild.Metafile;
9
9
  }
10
-
11
- export interface ISdCliNgPluginResultCache {
12
- watchFileSet?: Set<TNormPath>;
13
- affectedFileSet?: Set<TNormPath>;
14
- outputFiles?: esbuild.OutputFile[];
15
- metafile?: esbuild.Metafile;
16
- }
@@ -0,0 +1,24 @@
1
+ import { ISdBuildResult } from "../build/ISdBuildResult";
2
+ import { ISdWorkerType, TNormPath } from "@simplysm/sd-core-node";
3
+ import { ISdProjectConfig } from "../config/ISdProjectConfig";
4
+
5
+ export interface ISdBuildRunnerWorkerType extends ISdWorkerType {
6
+ methods: {
7
+ initialize: {
8
+ params: [ISdBuildRunnerInitializeRequest];
9
+ returnType: void;
10
+ };
11
+ rebuild: { params: [Set<TNormPath>?]; returnType: ISdBuildResult };
12
+ };
13
+ }
14
+
15
+ export interface ISdBuildRunnerInitializeRequest {
16
+ pkgPath: TNormPath;
17
+ projConf: ISdProjectConfig;
18
+
19
+ // watch
20
+ watch?: boolean;
21
+ emitOnly?: boolean;
22
+ noEmit?: boolean;
23
+ scopePathSet?: Set<TNormPath>;
24
+ }
@@ -0,0 +1,8 @@
1
+ export interface IServerWorkerType {
2
+ methods: {
3
+ listen: { params: [string | number]; returnType: number };
4
+ setPathProxy: { params: [Record<string, string>]; returnType: void };
5
+ broadcastReload: { params: [string | undefined, Set<string>]; returnType: void };
6
+ };
7
+ events: {};
8
+ }
@@ -3,7 +3,7 @@ import os from "os";
3
3
  import path from "path";
4
4
  import { PartialMessage } from "esbuild";
5
5
  import { ESLint } from "eslint";
6
- import { ISdBuildMessage } from "../types/build.types";
6
+ import { ISdBuildMessage } from "../types/build/ISdBuildMessage";
7
7
  import { PathUtils } from "@simplysm/sd-core-node";
8
8
 
9
9
  export class SdCliConvertMessageUtils {
@@ -23,7 +23,9 @@ export class SdCliConvertMessageUtils {
23
23
 
24
24
  const filePath = diag.file ? PathUtils.norm(path.resolve(diag.file.fileName)) : undefined;
25
25
  const position =
26
- diag.file && diag.start !== undefined ? diag.file.getLineAndCharacterOfPosition(diag.start) : undefined;
26
+ diag.file && diag.start !== undefined
27
+ ? diag.file.getLineAndCharacterOfPosition(diag.start)
28
+ : undefined;
27
29
  const line = position ? position.line + 1 : undefined;
28
30
  const char = position ? position.character + 1 : undefined;
29
31
 
@@ -47,7 +49,8 @@ export class SdCliConvertMessageUtils {
47
49
  orgPath: string,
48
50
  ): ISdBuildMessage[] {
49
51
  const convertFn = (msg: PartialMessage, severity: "error" | "warning") => {
50
- const filePath = msg.location?.file != null ? PathUtils.norm(orgPath, msg.location.file) : undefined;
52
+ const filePath =
53
+ msg.location?.file != null ? PathUtils.norm(orgPath, msg.location.file) : undefined;
51
54
  const line = msg.location?.line;
52
55
  const char = msg.location?.column;
53
56
  const code = msg.text!.slice(0, msg.text!.indexOf(":"));
@@ -1,12 +1,16 @@
1
1
  import { pathToFileURL } from "url";
2
2
  import path from "path";
3
- import { ISdProjectConfig } from "../../types/config.types";
3
+ import { ISdProjectConfig } from "../types/config/ISdProjectConfig";
4
4
 
5
- export async function loadProjConfAsync(rootPath: string, dev: boolean, opt: {
6
- config: string;
7
- options?: string[];
8
- }) {
5
+ export async function loadProjConfAsync(
6
+ rootPath: string,
7
+ dev: boolean,
8
+ opt: {
9
+ config: string;
10
+ options?: string[];
11
+ },
12
+ ) {
9
13
  const filePath = path.resolve(rootPath, opt.config);
10
14
  const imported = await import(pathToFileURL(filePath).href);
11
15
  return imported.default(dev, opt.options ?? []) as ISdProjectConfig;
12
- }
16
+ }
@@ -1,13 +1,21 @@
1
- import { createSdWorker, FsUtils, SdLogger, SdLoggerSeverity } from "@simplysm/sd-core-node";
2
- import { ISdBuildMessage } from "../types/build.types";
3
- import path from "path";
4
- import { SdServerBuildRunner } from "../pkg-builders/server/sd-server.build-runner";
5
- import { SdClientBuildRunner } from "../pkg-builders/client/sd-client.build-runner";
6
- import { SdTsLibBuildRunner } from "../pkg-builders/lib/sd-ts-lib.build-runner";
7
- import { SdJsLibBuildRunner } from "../pkg-builders/lib/sd-js-lib.build-runner";
8
- import { TSdBuildRunnerWorkerType } from "../types/worker.types";
9
- import { ISdBuildRunnerWorkerRequest } from "../types/build-runner.types";
1
+ import {
2
+ createSdWorker,
3
+ FsUtils,
4
+ SdLogger,
5
+ SdLoggerSeverity,
6
+ TNormPath,
7
+ } from "@simplysm/sd-core-node";
10
8
  import { EventEmitter } from "events";
9
+ import path from "path";
10
+ import {
11
+ ISdBuildRunnerInitializeRequest,
12
+ ISdBuildRunnerWorkerType,
13
+ } from "../types/worker/ISdBuildRunnerWorkerType";
14
+ import { SdBuildRunnerBase } from "../pkg-builders/commons/SdBuildRunnerBase";
15
+ import { SdServerBuildRunner } from "../pkg-builders/server/SdServerBuildRunner";
16
+ import { SdClientBuildRunner } from "../pkg-builders/client/SdClientBuildRunner";
17
+ import { SdTsLibBuildRunner } from "../pkg-builders/lib/SdTsLibBuildRunner";
18
+ import { SdJsLibBuildRunner } from "../pkg-builders/lib/SdJsLibBuildRunner";
11
19
 
12
20
  Error.stackTraceLimit = Infinity;
13
21
  EventEmitter.defaultMaxListeners = 0;
@@ -24,8 +32,10 @@ if (process.env["SD_DEBUG"] != null) {
24
32
  });
25
33
  }
26
34
 
27
- const worker = createSdWorker<TSdBuildRunnerWorkerType>({
28
- async run(req: ISdBuildRunnerWorkerRequest): Promise<ISdBuildMessage[] | void> {
35
+ let buildRunner: SdBuildRunnerBase<any>;
36
+
37
+ createSdWorker<ISdBuildRunnerWorkerType>({
38
+ initialize(req: ISdBuildRunnerInitializeRequest) {
29
39
  const pkgConf = req.projConf.packages[path.basename(req.pkgPath)]!;
30
40
 
31
41
  const buildRunnerType =
@@ -37,26 +47,17 @@ const worker = createSdWorker<TSdBuildRunnerWorkerType>({
37
47
  ? SdTsLibBuildRunner
38
48
  : SdJsLibBuildRunner;
39
49
 
40
- const builder = new buildRunnerType(
41
- req.projConf,
50
+ buildRunner = new buildRunnerType(
42
51
  req.pkgPath,
43
- req.workspaces,
52
+ req.projConf,
53
+ req.watch ?? false,
54
+ req.watch ? !pkgConf.forceProductionMode : false,
44
55
  req.emitOnly,
45
56
  req.noEmit,
46
- )
47
- .on("change", () => {
48
- worker.send("change");
49
- })
50
- .on("complete", (result) => {
51
- worker.send("complete", result);
52
- });
53
-
54
- if (req.cmd === "build") {
55
- const res = await builder.buildAsync();
56
- return res.buildMessages;
57
- } else {
58
- await builder.watchAsync();
59
- return;
60
- }
57
+ req.scopePathSet,
58
+ );
59
+ },
60
+ async rebuild(modifiedFileSet?: Set<TNormPath>) {
61
+ return await buildRunner.rebuildAsync(modifiedFileSet);
61
62
  },
62
63
  });
@@ -3,7 +3,7 @@ import { pathToFileURL } from "url";
3
3
  import type { SdServiceServer } from "@simplysm/sd-service-server";
4
4
  import { createSdWorker, SdLogger, SdLoggerSeverity } from "@simplysm/sd-core-node";
5
5
  import { EventEmitter } from "events";
6
- import { TServerWorkerType } from "../types/worker.types";
6
+ import { IServerWorkerType } from "../types/worker/IServerWorkerType";
7
7
 
8
8
  Error.stackTraceLimit = Infinity;
9
9
  EventEmitter.defaultMaxListeners = 0;
@@ -22,10 +22,10 @@ if (process.env["SD_DEBUG"] != null) {
22
22
 
23
23
  let server: SdServiceServer;
24
24
 
25
- createSdWorker<TServerWorkerType>({
26
- async listen(pkgInfo: { path: string } | { port: number }) {
27
- if ("path" in pkgInfo) {
28
- const mainFilePath = path.resolve(pkgInfo.path, "dist/main.js");
25
+ createSdWorker<IServerWorkerType>({
26
+ async listen(pkgPathOrPort: string | number) {
27
+ if (typeof pkgPathOrPort === "string") {
28
+ const mainFilePath = path.resolve(pkgPathOrPort, "dist/main.js");
29
29
  const serverModule = await import(pathToFileURL(mainFilePath).href);
30
30
  const currServer = serverModule.default as SdServiceServer | undefined;
31
31
  if (currServer == null) {
@@ -38,14 +38,14 @@ createSdWorker<TServerWorkerType>({
38
38
  server = new SdServiceServer({
39
39
  rootPath: process.cwd(),
40
40
  services: [],
41
- port: pkgInfo.port,
41
+ port: pkgPathOrPort,
42
42
  });
43
43
  await server.listenAsync();
44
44
  }
45
45
 
46
46
  return server.options.port;
47
47
  },
48
- setPathProxy(pathProxy: Record<string, string | number>) {
48
+ setPathProxy(pathProxy: Record<string, string>) {
49
49
  server.pathProxy = pathProxy;
50
50
  },
51
51
  broadcastReload(clientName: string | undefined, changedFileSet: Set<string>) {