@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
@@ -1,19 +1,20 @@
1
1
  import esbuild from "esbuild";
2
- import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
3
- import { ISdCliServerPluginResultCache } from "../../types/build-plugin.types";
2
+ import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
4
3
  import { PathUtils, TNormPath } from "@simplysm/sd-core-node";
5
- import { ISdTsCompilerResult } from "../../types/ts-compiler.types";
6
- import { SdTsCompiler } from "../../ts-compiler/sd-ts-compiler";
7
- import { ScopePathSet } from "../commons/scope-path";
4
+ import { SdTsCompiler } from "../../ts-compiler/SdTsCompiler";
5
+ import { ScopePathSet } from "../commons/ScopePathSet";
6
+ import { ISdCliServerPluginResultCache } from "../../types/plugin/ISdCliServerPluginResultCache";
7
+ import { ISdTsCompilerResult } from "../../types/build/ISdTsCompilerResult";
8
8
 
9
9
  export function createSdServerPlugin(conf: {
10
10
  pkgPath: TNormPath;
11
+ watch: boolean;
11
12
  dev: boolean;
12
13
  emitOnly: boolean;
13
14
  noEmit: boolean;
14
15
  modifiedFileSet: Set<TNormPath>;
15
16
  result: ISdCliServerPluginResultCache;
16
- watchScopePathSet: ScopePathSet;
17
+ scopePathSet: ScopePathSet;
17
18
  }): esbuild.Plugin {
18
19
  return {
19
20
  name: "sd-server-compile",
@@ -21,11 +22,12 @@ export function createSdServerPlugin(conf: {
21
22
  const tsCompiler = new SdTsCompiler({
22
23
  pkgPath: conf.pkgPath,
23
24
  additionalOptions: { declaration: false },
25
+ isWatchMode: conf.watch,
24
26
  isDevMode: conf.dev,
25
27
  isNoEmit: conf.noEmit,
26
28
  isEmitOnly: conf.emitOnly,
27
29
  isForBundle: true,
28
- watchScopePathSet: conf.watchScopePathSet,
30
+ scopePathSet: conf.scopePathSet,
29
31
  });
30
32
 
31
33
  let tsCompileResult: ISdTsCompilerResult;
@@ -6,12 +6,12 @@ import { SdLogger, SdLoggerSeverity } from "@simplysm/sd-core-node";
6
6
  import { EventEmitter } from "events";
7
7
  import yargs from "yargs";
8
8
  import { hideBin } from "yargs/helpers";
9
- import { SdCliAiCommand } from "./entry/sd-cli-ai-command";
10
- import { SdCliCordova } from "./entry/sd-cli-cordova";
11
- import { SdCliElectron } from "./entry/sd-cli-electron";
12
- import { SdCliLocalUpdate } from "./entry/sd-cli-local-update";
13
- import { SdCliPostinstall } from "./entry/sd-cli-postinstall";
14
- import { SdCliProject } from "./entry/sd-cli-project";
9
+ import { SdCliAiCommand } from "./entry/SdCliAiCommand";
10
+ import { SdCliCordova } from "./entry/SdCliCordova";
11
+ import { SdCliElectron } from "./entry/SdCliElectron";
12
+ import { SdCliLocalUpdate } from "./entry/SdCliLocalUpdate";
13
+ import { SdCliPostinstall } from "./entry/SdCliPostinstall";
14
+ import { SdCliProject } from "./entry/SdCliProject";
15
15
  import convertPrivateToHash from "./fix/convert-private-to-hash";
16
16
  import removeSdAngularSymbolNames from "./fix/remove-sd-angular-symbol-names";
17
17
  import convertSdAngularSymbolNames from "./fix/convert-sd-angular-symbol-names";
@@ -88,11 +88,6 @@ await yargs(hideBin(process.argv))
88
88
  array: true,
89
89
  describe: "수행할 패키지 설정",
90
90
  },
91
- inspects: {
92
- string: true,
93
- array: true,
94
- describe: "크롬 inspect를 수행할 패키지 설정",
95
- },
96
91
  emitOnly: {
97
92
  type: "boolean",
98
93
  describe: "emit만 수행",
@@ -133,7 +128,6 @@ await yargs(hideBin(process.argv))
133
128
  }),
134
129
  async (argv) => {
135
130
  await SdCliProject.buildAsync(argv);
136
- process.exit(0);
137
131
  },
138
132
  )
139
133
  .command(
package/src/sd-cli.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- /* eslint-disable no-console */
4
-
5
3
  import { exec, spawn } from "child_process";
6
4
  import os from "os";
7
5
  import path from "path";
@@ -67,6 +65,7 @@ function configureProcessorAffinityAndPriority(pid: number) {
67
65
 
68
66
  exec(command, (err) => {
69
67
  if (err) {
68
+ // eslint-disable-next-line no-console
70
69
  console.error("Affinity 또는 우선순위 설정 실패:", err.message);
71
70
  }
72
71
  });
@@ -91,19 +90,6 @@ function calculateAffinityMask(cpuCount: number): string {
91
90
  return "0x" + mask.toString(16).toUpperCase();
92
91
  }
93
92
 
94
- // ProcessorAffinity 마스크 계산 (뒤 코어 빼기)
95
- // function calculateAffinityMask(cpuCount: number): string {
96
- // const exclude = cpuCount <= 1 ? 0 : Math.ceil(cpuCount / 8); // 8개당 1개씩 뺌
97
- // const usable = cpuCount - exclude;
98
- //
99
- // if (usable <= 0) {
100
- // throw new Error(`CPU 사용 가능 개수가 0 이하입니다 (총: ${cpuCount}, 제외: ${exclude})`);
101
- // }
102
- //
103
- // const maskValue = (1 << usable) - 1;
104
- // return "0x" + maskValue.toString(16).toUpperCase();
105
- // }
106
-
107
93
  async function spawnWaitAsync(command: string, args: string[]) {
108
94
  await new Promise<void>((resolve) => {
109
95
  const child = spawn(command, args, {
@@ -1,17 +1,17 @@
1
1
  import ts from "typescript";
2
- import { SdDependencyCache } from "./sd-dependency-cache";
2
+ import { SdDepCache } from "./SdDepCache";
3
3
  import { PathUtils, TNormPath } from "@simplysm/sd-core-node";
4
4
  import path from "path";
5
5
  import { NgtscProgram } from "@angular/compiler-cli";
6
- import { ScopePathSet } from "../pkg-builders/commons/scope-path";
6
+ import { ScopePathSet } from "../pkg-builders/commons/ScopePathSet";
7
7
 
8
- export class SdDependencyAnalyzer {
8
+ export class SdDepAnalyzer {
9
9
  static analyze(
10
10
  program: ts.Program,
11
11
  compilerHost: ts.CompilerHost,
12
12
  scopePathSet: ScopePathSet,
13
13
  cache: {
14
- dep: SdDependencyCache;
14
+ dep: SdDepCache;
15
15
  type: WeakMap<ts.Node, ts.Type | undefined>;
16
16
  prop: WeakMap<ts.Type, Map<string, ts.Symbol | undefined>>;
17
17
  declFiles: WeakMap<ts.Symbol, TNormPath[]>;
@@ -162,8 +162,6 @@ export class SdDependencyAnalyzer {
162
162
  return s;
163
163
  };
164
164
 
165
- // const declFilesCache = new WeakMap<ts.Symbol, TNormPath[]>();
166
-
167
165
  const getDeclFileNPaths = (sym: ts.Symbol | undefined): TNormPath[] => {
168
166
  if (!sym) return [];
169
167
  const c = cache.declFiles.get(sym);
@@ -328,8 +326,6 @@ export class SdDependencyAnalyzer {
328
326
  ts.forEachChild(sf, visit);
329
327
  };
330
328
 
331
- // const ngToOrgCache = new Map<TNormPath, ts.SourceFile>();
332
-
333
329
  const getOrgSourceFile = (sf: ts.SourceFile) => {
334
330
  if (sf.fileName.endsWith(".ngtypecheck.ts")) {
335
331
  const sfNPath = PathUtils.norm(sf.fileName);
@@ -362,7 +358,7 @@ export class SdDependencyAnalyzer {
362
358
  static analyzeAngularResources(
363
359
  ngProgram: NgtscProgram,
364
360
  scopePathSet: ScopePathSet,
365
- depCache: SdDependencyCache,
361
+ depCache: SdDepCache,
366
362
  ) {
367
363
  for (const sf of ngProgram.getTsProgram().getSourceFiles()) {
368
364
  const fileNPath = PathUtils.norm(sf.fileName);
@@ -1,6 +1,6 @@
1
1
  import { TNormPath } from "@simplysm/sd-core-node";
2
2
 
3
- export class SdDependencyCache {
3
+ export class SdDepCache {
4
4
  /**
5
5
  * 각 파일이 export한 심볼 집합 (예: export const A → "A")
6
6
  */
@@ -59,13 +59,6 @@ export class SdDependencyCache {
59
59
  return [nPath];
60
60
  }
61
61
 
62
- /**
63
- * 전체 추적된 파일 경로를 반환
64
- */
65
- // getFiles(): Set<TNormPath> {
66
- // return new Set<TNormPath>([...this.#collectedCache.keys(), ...this.revDepCache.keys()]);
67
- // }
68
-
69
62
  /**
70
63
  * 분석이 완료된 파일로 표시
71
64
  */
@@ -174,63 +167,6 @@ export class SdDependencyCache {
174
167
  }
175
168
  }
176
169
 
177
- /**
178
- * 변경된 파일 경로 집합으로부터 영향을 받는 전체 파일 집합을 계산
179
- */
180
- /*getAffectedFileSet(modifiedNPathSet: Set<TNormPath>): Set<TNormPath> {
181
- const visited = new Set<string>();
182
- const result = new Set<TNormPath>();
183
-
184
- const queue: { fileNPath: TNormPath; exportSymbol: string | undefined }[] = [];
185
-
186
- const enqueue = (fileNPath: TNormPath, exportSymbol: string | undefined) => {
187
- const key = `${fileNPath}#${exportSymbol}`;
188
- if (!visited.has(key)) {
189
- visited.add(key);
190
- queue.push({ fileNPath, exportSymbol });
191
- }
192
- };
193
-
194
- for (const modifiedNPath of modifiedNPathSet) {
195
- for (const path of this.#getRelatedNPaths(modifiedNPath)) {
196
- result.add(path);
197
- const exportSymbols = this.#getExportSymbols(path);
198
- if (exportSymbols.size === 0) {
199
- enqueue(path, undefined);
200
- } else {
201
- for (const symbol of exportSymbols) {
202
- enqueue(path, symbol);
203
- }
204
- }
205
- }
206
- }
207
-
208
- while (queue.length > 0) {
209
- const curr = queue.shift()!;
210
- const revDepInfoMap = this._revDepCache.get(curr.fileNPath);
211
- if (!revDepInfoMap) continue;
212
-
213
- for (const [revDepFileNPath, revDepInfo] of revDepInfoMap) {
214
- if (curr.exportSymbol != null) {
215
- const hasImportSymbol = revDepInfo === 0 || revDepInfo.has(curr.exportSymbol);
216
- if (hasImportSymbol) {
217
- result.add(revDepFileNPath);
218
- const exportSymbol = this.#convertImportSymbolToExportSymbol(
219
- revDepFileNPath,
220
- curr.fileNPath,
221
- curr.exportSymbol,
222
- );
223
- enqueue(revDepFileNPath, exportSymbol);
224
- }
225
- } else {
226
- result.add(revDepFileNPath);
227
- }
228
- }
229
- }
230
-
231
- return result;
232
- }*/
233
-
234
170
  getAffectedFileMap(modifiedNPathSet: Set<TNormPath>): Map<TNormPath, Set<TNormPath>> {
235
171
  const resultMap = new Map<TNormPath, Set<TNormPath>>();
236
172
 
@@ -292,8 +228,6 @@ export class SdDependencyCache {
292
228
  * 주어진 파일들 및 그 영향 범위에 해당하는 모든 캐시를 무효화
293
229
  */
294
230
  invalidates(fileNPathSet: Set<TNormPath>) {
295
- // const affectedFileMap = this.getAffectedFileMap(fileNPathSet);
296
-
297
231
  const revDepCacheChanged = new Set<TNormPath>();
298
232
 
299
233
  for (const fileNPath of fileNPathSet) {
@@ -367,74 +301,4 @@ export class SdDependencyCache {
367
301
  this.#exportSymbolCache.set(fileNPath, result);
368
302
  return result;
369
303
  }
370
-
371
- /**
372
- * 변경된 파일로부터 영향을 받는 전체 트리를 반환
373
- * - 의존 관계를 시각화 및 구조적으로 추적할 수 있도록 트리 형태로 구성
374
- */
375
- // getAffectedFileTree(modifiedNPathSet: Set<TNormPath>): ISdAffectedFileTreeNode[] {
376
- // const visited = new Set<string>();
377
- // const nodeMap = new Map<string, ISdAffectedFileTreeNode>();
378
- //
379
- // const buildTree = (
380
- // fileNPath: TNormPath,
381
- // exportSymbol: string | undefined,
382
- // ): ISdAffectedFileTreeNode => {
383
- // const key = `${fileNPath}#${exportSymbol ?? "*"}`;
384
- // if (nodeMap.has(key)) return nodeMap.get(key)!;
385
- //
386
- // visited.add(key);
387
- //
388
- // const node: ISdAffectedFileTreeNode = {
389
- // fileNPath,
390
- // children: [],
391
- // };
392
- // nodeMap.set(key, node);
393
- //
394
- // const revDepInfoMap = this.revDepCache.get(fileNPath);
395
- // if (!revDepInfoMap) return node;
396
- //
397
- // for (const [revDepFileNPath, revDepInfo] of revDepInfoMap.entries()) {
398
- // const hasImportSymbol =
399
- // exportSymbol == null || revDepInfo === 0 || revDepInfo.has(exportSymbol);
400
- // if (!hasImportSymbol) continue;
401
- //
402
- // const nextExportSymbol =
403
- // exportSymbol != null
404
- // ? this.#convertImportSymbolToExportSymbol(revDepFileNPath, fileNPath, exportSymbol)
405
- // : undefined;
406
- //
407
- // const childKey = `${revDepFileNPath}#${nextExportSymbol ?? "*"}`;
408
- // if (visited.has(childKey)) continue;
409
- //
410
- // const childNode = buildTree(revDepFileNPath, nextExportSymbol);
411
- // node.children.push(childNode);
412
- // }
413
- //
414
- // return node;
415
- // };
416
- //
417
- // const result: ISdAffectedFileTreeNode[] = [];
418
- //
419
- // for (const modifiedNPath of modifiedNPathSet) {
420
- // for (const path of this.#getRelatedNPaths(modifiedNPath)) {
421
- // result.push(buildTree(path, undefined)); // root는 symbol상관없이
422
- // /*const exportSymbols = this.#getExportSymbols(path);
423
- // if (exportSymbols.size === 0) {
424
- // result.push(buildTree(path, undefined));
425
- // } else {
426
- // for (const symbol of exportSymbols) {
427
- // result.push(buildTree(path, symbol));
428
- // }
429
- // }*/
430
- // }
431
- // }
432
- //
433
- // return result;
434
- // }
435
- }
436
-
437
- export interface ISdAffectedFileTreeNode {
438
- fileNPath: TNormPath;
439
- children: ISdAffectedFileTreeNode[];
440
304
  }
@@ -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);
@@ -391,40 +368,35 @@ export class SdTsCompiler {
391
368
  }
392
369
 
393
370
  async #buildGlobalStyleAsync() {
371
+ if (!this.#isForAngular) return;
372
+
394
373
  //-- global style
395
- if (
396
- this._opt.globalStyleFilePath != null &&
397
- FsUtils.exists(this._opt.globalStyleFilePath) &&
398
- !this.#emittedFilesCacheMap.has(this._opt.globalStyleFilePath)
399
- ) {
400
- this.#debug(`전역 스타일 번들링 중...`);
401
-
402
- await this.#perf.run("전역 스타일 번들링", async () => {
403
- const data = await FsUtils.readFileAsync(this._opt.globalStyleFilePath!);
404
- const stylesheetBundlingResult = await this.#styleBundler!.bundleAsync(
405
- data,
406
- this._opt.globalStyleFilePath!,
407
- this._opt.globalStyleFilePath,
408
- );
409
- const emitFileInfos = this.#emittedFilesCacheMap.getOrCreate(
410
- this._opt.globalStyleFilePath!,
411
- [],
412
- );
413
- emitFileInfos.push({
414
- outAbsPath: PathUtils.norm(
415
- this._opt.pkgPath,
416
- path
417
- .relative(path.resolve(this._opt.pkgPath, "src"), this._opt.globalStyleFilePath!)
418
- .replace(/\.scss$/, ".css"),
419
- ),
420
- text: stylesheetBundlingResult.contents ?? "",
421
- });
374
+ const globalStyleFilePath = PathUtils.norm(this._opt.pkgPath, "src/styles.scss");
375
+ if (this.#emittedFilesCacheMap.has(globalStyleFilePath)) return;
376
+ if (!FsUtils.exists(globalStyleFilePath)) return;
377
+
378
+ this.#debug(`전역 스타일 번들링 중...`);
379
+
380
+ await this.#perf.run("전역 스타일 번들링", async () => {
381
+ const data = await FsUtils.readFileAsync(globalStyleFilePath);
382
+ const stylesheetBundlingResult = await this.#styleBundler!.bundleAsync(
383
+ data,
384
+ globalStyleFilePath,
385
+ globalStyleFilePath,
386
+ );
387
+ const emitFileInfos = this.#emittedFilesCacheMap.getOrCreate(globalStyleFilePath, []);
388
+ emitFileInfos.push({
389
+ outAbsPath: PathUtils.norm(
390
+ this._opt.pkgPath,
391
+ path
392
+ .relative(path.resolve(this._opt.pkgPath, "src"), globalStyleFilePath)
393
+ .replace(/\.scss$/, ".css"),
394
+ ),
395
+ text: stylesheetBundlingResult.contents ?? "",
422
396
  });
397
+ });
423
398
 
424
- return this._opt.globalStyleFilePath;
425
- }
426
-
427
- return undefined;
399
+ return globalStyleFilePath;
428
400
  }
429
401
 
430
402
  #build(prepareResult: IPrepareResult) {
@@ -459,8 +431,6 @@ export class SdTsCompiler {
459
431
  continue;
460
432
  }
461
433
 
462
- // this.#debug(`get diagnostics of file ${affectedFile}...`);
463
-
464
434
  this.#perf.run("개별 파일 진단 수집", () => {
465
435
  diagnostics.push(
466
436
  ...this.#program!.getSyntacticDiagnostics(affectedSourceFile),
@@ -507,8 +477,6 @@ export class SdTsCompiler {
507
477
  return relPath.replace(/\.ts$/, "").replaceAll("\\", "/") + ".js";
508
478
  }),
509
479
  );
510
-
511
- // (transformers.before ??= []).push(this.#createExternalizeComponentStylesTransformer());
512
480
  }
513
481
 
514
482
  this.#debug(`파일 출력 중...`);
@@ -595,106 +563,6 @@ export class SdTsCompiler {
595
563
  };
596
564
  }
597
565
 
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
566
  #convertOutputToReal(filePath: string, distPath: string, text: string) {
699
567
  let realFilePath = PathUtils.norm(filePath);
700
568
  let realText = text;