@simplysm/sd-cli 12.7.4 → 12.7.6

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 (167) hide show
  1. package/dist/entry/sd-cli-ai-command.d.ts +3 -0
  2. package/dist/entry/{SdAiCommand.js → sd-cli-ai-command.js} +14 -9
  3. package/dist/entry/sd-cli-ai-command.js.map +1 -0
  4. package/dist/entry/{SdCliCordova.d.ts → sd-cli-cordova.d.ts} +1 -1
  5. package/dist/entry/{SdCliCordova.js → sd-cli-cordova.js} +33 -31
  6. package/dist/entry/sd-cli-cordova.js.map +1 -0
  7. package/dist/entry/{SdCliElectron.d.ts → sd-cli-electron.d.ts} +1 -1
  8. package/dist/entry/{SdCliElectron.js → sd-cli-electron.js} +18 -16
  9. package/dist/entry/sd-cli-electron.js.map +1 -0
  10. package/dist/entry/{SdCliLocalUpdate.js → sd-cli-local-update.js} +12 -11
  11. package/dist/entry/sd-cli-local-update.js.map +1 -0
  12. package/dist/entry/{SdCliProject.js → sd-cli-project.js} +36 -33
  13. package/dist/entry/sd-cli-project.js.map +1 -0
  14. package/dist/index.d.ts +30 -30
  15. package/dist/index.js +30 -30
  16. package/dist/index.js.map +1 -1
  17. package/dist/pkg-builders/client/{SdCliNgRoutesFileGenerator.js → sd-cli-ng-routes.file-generator.js} +13 -12
  18. package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js.map +1 -0
  19. package/dist/pkg-builders/client/{SdClientBuildRunner.d.ts → sd-client.build-runner.d.ts} +3 -3
  20. package/dist/pkg-builders/client/{SdClientBuildRunner.js → sd-client.build-runner.js} +34 -24
  21. package/dist/pkg-builders/client/sd-client.build-runner.js.map +1 -0
  22. package/dist/pkg-builders/client/{SdNgBundlerContext.js → sd-ng.bundler-context.js} +5 -5
  23. package/dist/pkg-builders/client/sd-ng.bundler-context.js.map +1 -0
  24. package/dist/pkg-builders/client/{SdNgBundler.d.ts → sd-ng.bundler.d.ts} +3 -3
  25. package/dist/pkg-builders/client/{SdNgBundler.js → sd-ng.bundler.js} +55 -96
  26. package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -0
  27. package/dist/pkg-builders/client/{createSdNgPlugin.d.ts → sd-ng.plugin-creator.d.ts} +2 -2
  28. package/dist/pkg-builders/client/{createSdNgPlugin.js → sd-ng.plugin-creator.js} +18 -15
  29. package/dist/pkg-builders/client/sd-ng.plugin-creator.js.map +1 -0
  30. package/dist/pkg-builders/lib/{SdCliIndexFileGenerator.js → sd-cli-index.file-generator.js} +8 -8
  31. package/dist/pkg-builders/lib/sd-cli-index.file-generator.js.map +1 -0
  32. package/dist/pkg-builders/lib/{SdJsLibBuildRunner.d.ts → sd-js-lib.build-runner.d.ts} +2 -2
  33. package/dist/pkg-builders/lib/{SdJsLibBuildRunner.js → sd-js-lib.build-runner.js} +18 -15
  34. package/dist/pkg-builders/lib/sd-js-lib.build-runner.js.map +1 -0
  35. package/dist/pkg-builders/lib/{SdTsLibBuildRunner.d.ts → sd-ts-lib.build-runner.d.ts} +2 -2
  36. package/dist/pkg-builders/lib/{SdTsLibBuildRunner.js → sd-ts-lib.build-runner.js} +17 -15
  37. package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +1 -0
  38. package/dist/pkg-builders/lib/{SdTsLibBuilder.d.ts → sd-ts-lib.builder.d.ts} +2 -2
  39. package/dist/pkg-builders/lib/{SdTsLibBuilder.js → sd-ts-lib.builder.js} +11 -10
  40. package/dist/pkg-builders/lib/sd-ts-lib.builder.js.map +1 -0
  41. package/dist/pkg-builders/{SdMultiBuildRunner.d.ts → sd-multi.build-runner.d.ts} +2 -2
  42. package/dist/pkg-builders/{SdMultiBuildRunner.js → sd-multi.build-runner.js} +13 -8
  43. package/dist/pkg-builders/sd-multi.build-runner.js.map +1 -0
  44. package/dist/pkg-builders/server/{SdServerBuildRunner.d.ts → sd-server.build-runner.d.ts} +3 -3
  45. package/dist/pkg-builders/server/{SdServerBuildRunner.js → sd-server.build-runner.js} +35 -32
  46. package/dist/pkg-builders/server/sd-server.build-runner.js.map +1 -0
  47. package/dist/pkg-builders/server/{SdServerBundler.d.ts → sd-server.bundler.d.ts} +2 -2
  48. package/dist/pkg-builders/server/{SdServerBundler.js → sd-server.bundler.js} +15 -13
  49. package/dist/pkg-builders/server/sd-server.bundler.js.map +1 -0
  50. package/dist/pkg-builders/server/{createSdServerPlugin.d.ts → sd-server.plugin-creator.d.ts} +2 -2
  51. package/dist/pkg-builders/server/{createSdServerPlugin.js → sd-server.plugin-creator.js} +11 -8
  52. package/dist/pkg-builders/server/sd-server.plugin-creator.js.map +1 -0
  53. package/dist/sd-cli.js +10 -10
  54. package/dist/sd-cli.js.map +1 -1
  55. package/dist/{ts-builder/SdTsCompiler.d.ts → ts-compiler/sd-ts-compiler.d.ts} +2 -2
  56. package/dist/{ts-builder/SdTsCompiler.js → ts-compiler/sd-ts-compiler.js} +72 -65
  57. package/dist/ts-compiler/sd-ts-compiler.js.map +1 -0
  58. package/dist/types/{build-plugin.type.d.ts → build-plugin.types.d.ts} +1 -1
  59. package/dist/types/build-plugin.types.js +3 -0
  60. package/dist/types/build-plugin.types.js.map +1 -0
  61. package/dist/types/{build-runner.type.d.ts → build-runner.types.d.ts} +2 -2
  62. package/dist/types/build-runner.types.js +3 -0
  63. package/dist/types/build-runner.types.js.map +1 -0
  64. package/dist/types/{build.type.d.ts → build.types.d.ts} +1 -1
  65. package/dist/types/build.types.js +2 -0
  66. package/dist/types/build.types.js.map +1 -0
  67. package/dist/types/common-configs.types.js +2 -0
  68. package/dist/types/common-configs.types.js.map +1 -0
  69. package/dist/types/config.types.js +2 -0
  70. package/dist/types/config.types.js.map +1 -0
  71. package/dist/types/{ts-compiler.type.d.ts → ts-compiler.types.d.ts} +3 -3
  72. package/dist/types/ts-compiler.types.js +5 -0
  73. package/dist/types/ts-compiler.types.js.map +1 -0
  74. package/dist/types/{workers.type.d.ts → worker.types.d.ts} +2 -2
  75. package/dist/types/worker.types.js +3 -0
  76. package/dist/types/worker.types.js.map +1 -0
  77. package/dist/utils/{SdCliConvertMessageUtil.d.ts → sd-cli-convert-message.utils.d.ts} +3 -3
  78. package/dist/utils/{SdCliConvertMessageUtil.js → sd-cli-convert-message.utils.js} +9 -6
  79. package/dist/utils/sd-cli-convert-message.utils.js.map +1 -0
  80. package/dist/utils/{SdCliPerformanceTime.js → sd-cli-performance-time.js} +1 -1
  81. package/dist/utils/sd-cli-performance-time.js.map +1 -0
  82. package/dist/workers/{build-runner-worker.js → build-runner.worker.js} +13 -10
  83. package/dist/workers/build-runner.worker.js.map +1 -0
  84. package/dist/workers/{server-worker.js → server.worker.js} +6 -5
  85. package/dist/workers/server.worker.js.map +1 -0
  86. package/package.json +7 -7
  87. package/src/entry/{SdAiCommand.ts → sd-cli-ai-command.ts} +18 -8
  88. package/src/entry/{SdCliCordova.ts → sd-cli-cordova.ts} +32 -32
  89. package/src/entry/{SdCliElectron.ts → sd-cli-electron.ts} +17 -17
  90. package/src/entry/{SdCliLocalUpdate.ts → sd-cli-local-update.ts} +11 -11
  91. package/src/entry/{SdCliProject.ts → sd-cli-project.ts} +36 -36
  92. package/src/index.ts +30 -30
  93. package/src/pkg-builders/client/{SdCliNgRoutesFileGenerator.ts → sd-cli-ng-routes.file-generator.ts} +14 -12
  94. package/src/pkg-builders/client/{SdClientBuildRunner.ts → sd-client.build-runner.ts} +52 -45
  95. package/src/pkg-builders/client/{SdNgBundlerContext.ts → sd-ng.bundler-context.ts} +4 -4
  96. package/src/pkg-builders/client/{SdNgBundler.ts → sd-ng.bundler.ts} +98 -130
  97. package/src/pkg-builders/client/{createSdNgPlugin.ts → sd-ng.plugin-creator.ts} +16 -16
  98. package/src/pkg-builders/lib/{SdCliIndexFileGenerator.ts → sd-cli-index.file-generator.ts} +7 -7
  99. package/src/pkg-builders/lib/{SdJsLibBuildRunner.ts → sd-js-lib.build-runner.ts} +16 -16
  100. package/src/pkg-builders/lib/{SdTsLibBuildRunner.ts → sd-ts-lib.build-runner.ts} +17 -17
  101. package/src/pkg-builders/lib/{SdTsLibBuilder.ts → sd-ts-lib.builder.ts} +10 -10
  102. package/src/pkg-builders/{SdMultiBuildRunner.ts → sd-multi.build-runner.ts} +12 -12
  103. package/src/pkg-builders/server/{SdServerBuildRunner.ts → sd-server.build-runner.ts} +34 -34
  104. package/src/pkg-builders/server/{SdServerBundler.ts → sd-server.bundler.ts} +15 -15
  105. package/src/pkg-builders/server/{createSdServerPlugin.ts → sd-server.plugin-creator.ts} +9 -9
  106. package/src/sd-cli.ts +10 -10
  107. package/src/{ts-builder/SdTsCompiler.ts → ts-compiler/sd-ts-compiler.ts} +146 -78
  108. package/src/types/{build-plugin.type.ts → build-plugin.types.ts} +1 -1
  109. package/src/types/{build-runner.type.ts → build-runner.types.ts} +2 -2
  110. package/src/types/{build.type.ts → build.types.ts} +1 -1
  111. package/src/types/{ts-compiler.type.ts → ts-compiler.types.ts} +3 -3
  112. package/src/types/{workers.type.ts → worker.types.ts} +2 -2
  113. package/src/utils/{SdCliConvertMessageUtil.ts → sd-cli-convert-message.utils.ts} +7 -7
  114. package/src/workers/{build-runner-worker.ts → build-runner.worker.ts} +12 -12
  115. package/src/workers/{server-worker.ts → server.worker.ts} +5 -5
  116. package/tsconfig.json +2 -1
  117. package/dist/entry/SdAiCommand.d.ts +0 -3
  118. package/dist/entry/SdAiCommand.js.map +0 -1
  119. package/dist/entry/SdCliCordova.js.map +0 -1
  120. package/dist/entry/SdCliElectron.js.map +0 -1
  121. package/dist/entry/SdCliLocalUpdate.js.map +0 -1
  122. package/dist/entry/SdCliProject.js.map +0 -1
  123. package/dist/pkg-builders/SdMultiBuildRunner.js.map +0 -1
  124. package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js.map +0 -1
  125. package/dist/pkg-builders/client/SdClientBuildRunner.js.map +0 -1
  126. package/dist/pkg-builders/client/SdNgBundler.js.map +0 -1
  127. package/dist/pkg-builders/client/SdNgBundlerContext.js.map +0 -1
  128. package/dist/pkg-builders/client/createSdNgPlugin.js.map +0 -1
  129. package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js.map +0 -1
  130. package/dist/pkg-builders/lib/SdJsLibBuildRunner.js.map +0 -1
  131. package/dist/pkg-builders/lib/SdTsLibBuildRunner.js.map +0 -1
  132. package/dist/pkg-builders/lib/SdTsLibBuilder.js.map +0 -1
  133. package/dist/pkg-builders/server/SdServerBuildRunner.js.map +0 -1
  134. package/dist/pkg-builders/server/SdServerBundler.js.map +0 -1
  135. package/dist/pkg-builders/server/createSdServerPlugin.js.map +0 -1
  136. package/dist/ts-builder/SdTsCompiler.js.map +0 -1
  137. package/dist/types/build-plugin.type.js +0 -2
  138. package/dist/types/build-plugin.type.js.map +0 -1
  139. package/dist/types/build-runner.type.js +0 -2
  140. package/dist/types/build-runner.type.js.map +0 -1
  141. package/dist/types/build.type.js +0 -2
  142. package/dist/types/build.type.js.map +0 -1
  143. package/dist/types/common-configs.type.js +0 -2
  144. package/dist/types/common-configs.type.js.map +0 -1
  145. package/dist/types/sd-configs.type.js +0 -2
  146. package/dist/types/sd-configs.type.js.map +0 -1
  147. package/dist/types/ts-compiler.type.js +0 -2
  148. package/dist/types/ts-compiler.type.js.map +0 -1
  149. package/dist/types/workers.type.js +0 -2
  150. package/dist/types/workers.type.js.map +0 -1
  151. package/dist/utils/SdCliConvertMessageUtil.js.map +0 -1
  152. package/dist/utils/SdCliPerformanceTime.js.map +0 -1
  153. package/dist/workers/build-runner-worker.js.map +0 -1
  154. package/dist/workers/server-worker.js.map +0 -1
  155. /package/dist/entry/{SdCliLocalUpdate.d.ts → sd-cli-local-update.d.ts} +0 -0
  156. /package/dist/entry/{SdCliProject.d.ts → sd-cli-project.d.ts} +0 -0
  157. /package/dist/pkg-builders/client/{SdCliNgRoutesFileGenerator.d.ts → sd-cli-ng-routes.file-generator.d.ts} +0 -0
  158. /package/dist/pkg-builders/client/{SdNgBundlerContext.d.ts → sd-ng.bundler-context.d.ts} +0 -0
  159. /package/dist/pkg-builders/lib/{SdCliIndexFileGenerator.d.ts → sd-cli-index.file-generator.d.ts} +0 -0
  160. /package/dist/types/{common-configs.type.d.ts → common-configs.types.d.ts} +0 -0
  161. /package/dist/types/{sd-configs.type.d.ts → config.types.d.ts} +0 -0
  162. /package/dist/utils/{SdCliPerformanceTime.d.ts → sd-cli-performance-time.d.ts} +0 -0
  163. /package/dist/workers/{build-runner-worker.d.ts → build-runner.worker.d.ts} +0 -0
  164. /package/dist/workers/{server-worker.d.ts → server.worker.d.ts} +0 -0
  165. /package/src/types/{common-configs.type.ts → common-configs.types.ts} +0 -0
  166. /package/src/types/{sd-configs.type.ts → config.types.ts} +0 -0
  167. /package/src/utils/{SdCliPerformanceTime.ts → sd-cli-performance-time.ts} +0 -0
@@ -1,22 +1,32 @@
1
1
  import ts from "typescript";
2
2
  import path from "path";
3
- import { FsUtil, Logger, PathUtil, TNormPath } from "@simplysm/sd-core-node";
4
- import { StringUtil } from "@simplysm/sd-core-common";
3
+ import { FsUtils, SdLogger, PathUtils, type TNormPath } from "@simplysm/sd-core-node";
4
+ import { StringUtils } from "@simplysm/sd-core-common";
5
5
  import { NgtscProgram, OptimizeFor } from "@angular/compiler-cli";
6
- import { ComponentStylesheetBundler } from "@angular/build/src/tools/esbuild/angular/component-stylesheets";
7
- import { AngularCompilerHost } from "@angular/build/src/tools/angular/angular-host";
6
+ import {
7
+ ComponentStylesheetBundler,
8
+ } from "@angular/build/src/tools/esbuild/angular/component-stylesheets";
9
+ import { type AngularCompilerHost } from "@angular/build/src/tools/angular/angular-host";
8
10
  import { transformSupportedBrowsersToTargets } from "@angular/build/src/tools/esbuild/utils";
9
11
  import browserslist from "browserslist";
10
- import { replaceBootstrap } from "@angular/build/src/tools/angular/transformers/jit-bootstrap-transformer";
11
- import { SdCliPerformanceTimer } from "../utils/SdCliPerformanceTime";
12
- import { SdCliConvertMessageUtil } from "../utils/SdCliConvertMessageUtil";
13
- import { ISdTsCompilerResult, IStylesheetBundlingResult, SdTsCompilerOptions } from "../types/ts-compiler.type";
14
- import { ISdBuildMessage } from "../types/build.type";
15
- import { createWorkerTransformer } from "@angular/build/src/tools/angular/transformers/web-worker-transformer";
12
+ import {
13
+ replaceBootstrap,
14
+ } from "@angular/build/src/tools/angular/transformers/jit-bootstrap-transformer";
15
+ import { SdCliPerformanceTimer } from "../utils/sd-cli-performance-time";
16
+ import { SdCliConvertMessageUtils } from "../utils/sd-cli-convert-message.utils";
17
+ import {
18
+ type ISdTsCompilerResult,
19
+ type IStylesheetBundlingResult,
20
+ type SdTsCompilerOptions,
21
+ } from "../types/ts-compiler.types";
22
+ import { type ISdBuildMessage } from "../types/build.types";
23
+ import {
24
+ createWorkerTransformer,
25
+ } from "@angular/build/src/tools/angular/transformers/web-worker-transformer";
16
26
  import { ESLint } from "eslint";
17
27
 
18
28
  export class SdTsCompiler {
19
- readonly #logger = Logger.get(["simplysm", "sd-cli", "SdTsCompiler"]);
29
+ readonly #logger = SdLogger.get(["simplysm", "sd-cli", "SdTsCompiler"]);
20
30
 
21
31
  readonly #parsedTsconfig: ts.ParsedCommandLine;
22
32
  readonly #isForAngular: boolean;
@@ -70,14 +80,17 @@ export class SdTsCompiler {
70
80
  //-- isForAngular / parsedTsConfig
71
81
 
72
82
  const tsconfigPath = path.resolve(opt.pkgPath, "tsconfig.json");
73
- const tsconfig = FsUtil.readJson(tsconfigPath);
83
+ const tsconfig = FsUtils.readJson(tsconfigPath);
74
84
  this.#isForAngular = Boolean(tsconfig.angularCompilerOptions);
75
85
  this.#parsedTsconfig = ts.parseJsonConfigFileContent(tsconfig, ts.sys, opt.pkgPath, {
76
86
  ...tsconfig.angularCompilerOptions,
77
87
  ...opt.additionalOptions,
78
88
  });
79
89
 
80
- this.#distPath = PathUtil.norm(this.#parsedTsconfig.options.outDir ?? path.resolve(opt.pkgPath, "dist"));
90
+ this.#distPath = PathUtils.norm(this.#parsedTsconfig.options.outDir ?? path.resolve(
91
+ opt.pkgPath,
92
+ "dist",
93
+ ));
81
94
 
82
95
  //-- compilerHost
83
96
 
@@ -91,8 +104,8 @@ export class SdTsCompiler {
91
104
  shouldCreateNewSourceFile?: boolean,
92
105
  ...args
93
106
  ): ts.SourceFile | undefined => {
94
- if (!shouldCreateNewSourceFile && this.#sourceFileCacheMap.has(PathUtil.norm(fileName))) {
95
- return this.#sourceFileCacheMap.get(PathUtil.norm(fileName));
107
+ if (!shouldCreateNewSourceFile && this.#sourceFileCacheMap.has(PathUtils.norm(fileName))) {
108
+ return this.#sourceFileCacheMap.get(PathUtils.norm(fileName));
96
109
  }
97
110
 
98
111
  const sf: ts.SourceFile | undefined = baseGetSourceFile.call(
@@ -105,10 +118,10 @@ export class SdTsCompiler {
105
118
  );
106
119
 
107
120
  if (sf) {
108
- this.#sourceFileCacheMap.set(PathUtil.norm(fileName), sf);
121
+ this.#sourceFileCacheMap.set(PathUtils.norm(fileName), sf);
109
122
  }
110
123
  else {
111
- this.#sourceFileCacheMap.delete(PathUtil.norm(fileName));
124
+ this.#sourceFileCacheMap.delete(PathUtils.norm(fileName));
112
125
  }
113
126
 
114
127
  return sf;
@@ -116,7 +129,7 @@ export class SdTsCompiler {
116
129
 
117
130
  const baseReadFile = this.#compilerHost.readFile;
118
131
  this.#compilerHost.readFile = (fileName) => {
119
- this.#watchFileSet.add(PathUtil.norm(fileName));
132
+ this.#watchFileSet.add(PathUtils.norm(fileName));
120
133
  return baseReadFile.call(this.#compilerHost, fileName);
121
134
  };
122
135
 
@@ -167,20 +180,24 @@ export class SdTsCompiler {
167
180
 
168
181
  const contents = await this.#bundleStylesheetAsync(
169
182
  data,
170
- PathUtil.norm(context.containingFile),
171
- context.resourceFile != null ? PathUtil.norm(context.resourceFile) : undefined,
183
+ PathUtils.norm(context.containingFile),
184
+ context.resourceFile != null ? PathUtils.norm(context.resourceFile) : undefined,
172
185
  );
173
186
 
174
- return StringUtil.isNullOrEmpty(contents) ? null : { content: contents };
187
+ return StringUtils.isNullOrEmpty(contents) ? null : { content: contents };
175
188
  };
176
189
 
177
190
  (this.#compilerHost as AngularCompilerHost).getModifiedResourceFiles = () => {
178
- return new Set(Array.from(this.#modifiedFileSet).map((item) => PathUtil.posix(item)));
191
+ return new Set(Array.from(this.#modifiedFileSet).map((item) => PathUtils.posix(item)));
179
192
  };
180
193
  }
181
194
  }
182
195
 
183
- async #bundleStylesheetAsync(data: string, containingFile: TNormPath, resourceFile: TNormPath | null = null) {
196
+ async #bundleStylesheetAsync(
197
+ data: string,
198
+ containingFile: TNormPath,
199
+ resourceFile: TNormPath | null = null,
200
+ ) {
184
201
  // containingFile: 포함된 파일 (.ts)
185
202
  // resourceFile: 외부 리소스 파일 (styleUrls로 입력하지 않고 styles에 직접 입력한 경우 null)
186
203
  // referencedFiles: import한 외부 scss 파일 혹은 woff파일등 외부 파일
@@ -196,18 +213,19 @@ export class SdTsCompiler {
196
213
  if (stylesheetResult.referencedFiles) {
197
214
  for (const referencedFile of stylesheetResult.referencedFiles) {
198
215
  const depCacheSet = this.#resourceDependencyCacheMap.getOrCreate(
199
- PathUtil.norm(referencedFile),
216
+ PathUtils.norm(referencedFile),
200
217
  new Set<TNormPath>(),
201
218
  );
202
219
  depCacheSet.add(resourceFile ?? containingFile);
203
220
  }
204
221
 
205
222
  this.#watchFileSet.adds(
206
- ...Array.from(stylesheetResult.referencedFiles.values()).map((item) => PathUtil.norm(item)),
223
+ ...Array.from(stylesheetResult.referencedFiles.values())
224
+ .map((item) => PathUtils.norm(item)),
207
225
  );
208
226
  }
209
227
 
210
- this.#stylesheetBundlingResultMap.set(PathUtil.norm(resourceFile ?? containingFile), {
228
+ this.#stylesheetBundlingResultMap.set(PathUtils.norm(resourceFile ?? containingFile), {
211
229
  outputFiles: stylesheetResult.errors == null ? stylesheetResult.outputFiles : undefined,
212
230
  metafile: stylesheetResult.errors == null ? stylesheetResult.metafile : undefined,
213
231
  errors: stylesheetResult.errors,
@@ -242,8 +260,8 @@ export class SdTsCompiler {
242
260
  return {
243
261
  messages: [
244
262
  ...prepareResult.messages,
245
- ...SdCliConvertMessageUtil.convertToBuildMessagesFromTsDiag(buildResult.diagnostics),
246
- ...SdCliConvertMessageUtil.convertToBuildMessagesFromEslint(lintResults),
263
+ ...SdCliConvertMessageUtils.convertToBuildMessagesFromTsDiag(buildResult.diagnostics),
264
+ ...SdCliConvertMessageUtils.convertToBuildMessagesFromEslint(lintResults),
247
265
  ],
248
266
  watchFileSet: this.#watchFileSet,
249
267
  affectedFileSet: this.#affectedFileSet,
@@ -262,17 +280,16 @@ export class SdTsCompiler {
262
280
  this.#affectedFileSet.add(modifiedFile);
263
281
  this.#affectedFileSet.adds(...(this.#revDependencyCacheMap.get(modifiedFile) ?? []));
264
282
  this.#affectedFileSet.adds(...(this.#resourceDependencyCacheMap.get(modifiedFile) ?? []));
265
-
266
- this.#emittedFilesCacheMap.delete(modifiedFile);
267
283
  }
268
284
  });
269
285
 
270
286
  this.#debug(`invalidate & clear cache...`);
271
287
 
272
288
  this.#perf.run("invalidate & clear cache", () => {
273
- this.#stylesheetBundler?.invalidate(this.#modifiedFileSet);
289
+ this.#stylesheetBundler?.invalidate(this.#affectedFileSet);
274
290
 
275
291
  for (const affectedFile of this.#affectedFileSet) {
292
+ this.#emittedFilesCacheMap.delete(affectedFile);
276
293
  this.#sourceFileCacheMap.delete(affectedFile);
277
294
  this.#stylesheetBundlingResultMap.delete(affectedFile);
278
295
  this.#watchFileSet.delete(affectedFile);
@@ -340,18 +357,24 @@ export class SdTsCompiler {
340
357
  }[]
341
358
  >();
342
359
  for (const sf of sourceFileSet) {
343
- if (!this.#watchScopePaths.some((scopePath) => PathUtil.isChildPath(sf.fileName, scopePath))) {
360
+ if (!this.#watchScopePaths.some((scopePath) => PathUtils.isChildPath(
361
+ sf.fileName,
362
+ scopePath,
363
+ ))) {
344
364
  continue;
345
365
  }
346
366
 
347
367
  const refs = this.#findDeps(sf);
348
368
  messages.push(...refs.filter((item) => "severity" in item));
349
369
  depMap.set(
350
- PathUtil.norm(sf.fileName),
370
+ PathUtils.norm(sf.fileName),
351
371
  refs
352
372
  .filter((item) => "fileName" in item)
353
373
  .filter((item) =>
354
- this.#watchScopePaths.some((scopePath) => PathUtil.isChildPath(item.fileName, scopePath)),
374
+ this.#watchScopePaths.some((scopePath) => PathUtils.isChildPath(
375
+ item.fileName,
376
+ scopePath,
377
+ )),
355
378
  ),
356
379
  );
357
380
  }
@@ -375,15 +398,22 @@ export class SdTsCompiler {
375
398
  if (prevSet?.has(targetRefItem.fileName)) continue;
376
399
 
377
400
  result.add(targetRefItem.fileName);
378
- result.adds(...getAllDeps(targetRefItem.fileName, new Set<TNormPath>(prevSet).adds(...result)));
401
+ result.adds(...getAllDeps(
402
+ targetRefItem.fileName,
403
+ new Set<TNormPath>(prevSet).adds(...result),
404
+ ));
379
405
  }
380
406
  }
381
407
  else {
382
- for (const targetRefItem of targetDeps.filter((item) => item.exportName === dep.importName)) {
408
+ for (const targetRefItem of targetDeps.filter((item) => item.exportName
409
+ === dep.importName)) {
383
410
  if (prevSet?.has(targetRefItem.fileName)) continue;
384
411
 
385
412
  result.add(targetRefItem.fileName);
386
- result.adds(...getAllDeps(targetRefItem.fileName, new Set<TNormPath>(prevSet).adds(...result)));
413
+ result.adds(...getAllDeps(
414
+ targetRefItem.fileName,
415
+ new Set<TNormPath>(prevSet).adds(...result),
416
+ ));
387
417
  }
388
418
  }
389
419
  }
@@ -392,12 +422,12 @@ export class SdTsCompiler {
392
422
  };
393
423
 
394
424
  for (const sf of sourceFileSet) {
395
- const deps = getAllDeps(PathUtil.norm(sf.fileName));
396
- allDepMap.set(PathUtil.norm(sf.fileName), deps);
425
+ const deps = getAllDeps(PathUtils.norm(sf.fileName));
426
+ allDepMap.set(PathUtils.norm(sf.fileName), deps);
397
427
 
398
- for (const dep of getAllDeps(PathUtil.norm(sf.fileName))) {
428
+ for (const dep of getAllDeps(PathUtils.norm(sf.fileName))) {
399
429
  const depCache = this.#revDependencyCacheMap.getOrCreate(dep, new Set<TNormPath>());
400
- depCache.add(PathUtil.norm(sf.fileName));
430
+ depCache.add(PathUtils.norm(sf.fileName));
401
431
  }
402
432
 
403
433
  if (this.#ngProgram) {
@@ -406,8 +436,11 @@ export class SdTsCompiler {
406
436
  }
407
437
 
408
438
  for (const dep of this.#ngProgram.compiler.getResourceDependencies(sf)) {
409
- const ref = this.#resourceDependencyCacheMap.getOrCreate(PathUtil.norm(dep), new Set<TNormPath>());
410
- ref.add(PathUtil.norm(sf.fileName));
439
+ const ref = this.#resourceDependencyCacheMap.getOrCreate(
440
+ PathUtils.norm(dep),
441
+ new Set<TNormPath>(),
442
+ );
443
+ ref.add(PathUtils.norm(sf.fileName));
411
444
  }
412
445
  }
413
446
  }
@@ -418,11 +451,14 @@ export class SdTsCompiler {
418
451
 
419
452
  this.#perf.run("get affected (init)", () => {
420
453
  for (const sf of sourceFileSet) {
421
- if (!this.#watchScopePaths.some((scopePath) => PathUtil.isChildPath(sf.fileName, scopePath))) {
454
+ if (!this.#watchScopePaths.some((scopePath) => PathUtils.isChildPath(
455
+ sf.fileName,
456
+ scopePath,
457
+ ))) {
422
458
  continue;
423
459
  }
424
460
 
425
- this.#affectedFileSet.add(PathUtil.norm(sf.fileName));
461
+ this.#affectedFileSet.add(PathUtils.norm(sf.fileName));
426
462
  }
427
463
  });
428
464
  }
@@ -434,7 +470,7 @@ export class SdTsCompiler {
434
470
  [
435
471
  item,
436
472
  // .d.ts면 .js파일도 affected에 추가
437
- item.endsWith(".d.ts") ? PathUtil.norm(item.replace(/\.d\.ts$/, ".js")) : undefined,
473
+ item.endsWith(".d.ts") ? PathUtils.norm(item.replace(/\.d\.ts$/, ".js")) : undefined,
438
474
  ].filterExists(),
439
475
  ),
440
476
  );
@@ -468,12 +504,12 @@ export class SdTsCompiler {
468
504
 
469
505
  async #lintAsync() {
470
506
  const lintFilePaths = Array.from(this.#affectedFileSet)
471
- .filter((item) => PathUtil.isChildPath(item, this.#pkgPath))
507
+ .filter((item) => PathUtils.isChildPath(item, this.#pkgPath))
472
508
  .filter((item) => (
473
509
  (!item.endsWith(".d.ts") && item.endsWith(".ts")) ||
474
510
  item.endsWith(".js")
475
511
  ))
476
- .filter((item) => FsUtil.exists(item));
512
+ .filter((item) => FsUtils.exists(item));
477
513
 
478
514
  if (lintFilePaths.length === 0) {
479
515
  return [];
@@ -523,7 +559,7 @@ export class SdTsCompiler {
523
559
  this.#debug(`get diagnostics of files...`);
524
560
 
525
561
  for (const affectedFile of this.#affectedFileSet) {
526
- if (!PathUtil.isChildPath(affectedFile, this.#pkgPath)) {
562
+ if (!PathUtils.isChildPath(affectedFile, this.#pkgPath)) {
527
563
  continue;
528
564
  }
529
565
 
@@ -552,7 +588,10 @@ export class SdTsCompiler {
552
588
  }
553
589
 
554
590
  diagnostics.push(
555
- ...this.#ngProgram!.compiler.getDiagnosticsForFile(affectedSourceFile, OptimizeFor.WholeProgram),
591
+ ...this.#ngProgram!.compiler.getDiagnosticsForFile(
592
+ affectedSourceFile,
593
+ OptimizeFor.WholeProgram,
594
+ ),
556
595
  );
557
596
  });
558
597
  }
@@ -608,7 +647,7 @@ export class SdTsCompiler {
608
647
 
609
648
  // esbuild를 통해 bundle로 묶어야 하는놈들은 모든 output이 있어야 함.
610
649
  if (!this.#isForBundle) {
611
- if (!PathUtil.isChildPath(sf.fileName, this.#pkgPath)) {
650
+ if (!PathUtils.isChildPath(sf.fileName, this.#pkgPath)) {
612
651
  continue;
613
652
  }
614
653
  }
@@ -617,7 +656,14 @@ export class SdTsCompiler {
617
656
  sf,
618
657
  (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
619
658
  if (!sourceFiles || sourceFiles.length === 0) {
620
- this.#compilerHost.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
659
+ this.#compilerHost.writeFile(
660
+ fileName,
661
+ text,
662
+ writeByteOrderMark,
663
+ onError,
664
+ sourceFiles,
665
+ data,
666
+ );
621
667
  return;
622
668
  }
623
669
 
@@ -629,17 +675,24 @@ export class SdTsCompiler {
629
675
  this.#ngProgram.compiler.incrementalCompilation.recordSuccessfulEmit(sourceFile);
630
676
  }
631
677
 
632
- const emitFileInfoCaches = this.#emittedFilesCacheMap.getOrCreate(PathUtil.norm(sourceFile.fileName), []);
678
+ const emitFileInfoCaches = this.#emittedFilesCacheMap.getOrCreate(PathUtils.norm(
679
+ sourceFile.fileName), []);
633
680
 
634
- if (PathUtil.isChildPath(sourceFile.fileName, this.#pkgPath)) {
635
- let realFilePath = PathUtil.norm(fileName);
681
+ if (PathUtils.isChildPath(sourceFile.fileName, this.#pkgPath)) {
682
+ let realFilePath = PathUtils.norm(fileName);
636
683
  let realText = text;
637
684
  if (
638
- PathUtil.isChildPath(realFilePath, path.resolve(this.#distPath, path.basename(this.#pkgPath), "src"))
685
+ PathUtils.isChildPath(
686
+ realFilePath,
687
+ path.resolve(this.#distPath, path.basename(this.#pkgPath), "src"),
688
+ )
639
689
  ) {
640
- realFilePath = PathUtil.norm(
690
+ realFilePath = PathUtils.norm(
641
691
  this.#distPath,
642
- path.relative(path.resolve(this.#distPath, path.basename(this.#pkgPath), "src"), realFilePath),
692
+ path.relative(
693
+ path.resolve(this.#distPath, path.basename(this.#pkgPath), "src"),
694
+ realFilePath,
695
+ ),
643
696
  );
644
697
 
645
698
  if (fileName.endsWith(".js.map")) {
@@ -659,7 +712,7 @@ export class SdTsCompiler {
659
712
  emitFileInfoCaches.push({ text });
660
713
  }
661
714
 
662
- emitFileSet.add(PathUtil.norm(sourceFile.fileName));
715
+ emitFileSet.add(PathUtils.norm(sourceFile.fileName));
663
716
  },
664
717
  undefined,
665
718
  undefined,
@@ -671,19 +724,27 @@ export class SdTsCompiler {
671
724
  //-- global style
672
725
  if (
673
726
  this.#globalStyleFilePath != null &&
674
- FsUtil.exists(this.#globalStyleFilePath) &&
727
+ FsUtils.exists(this.#globalStyleFilePath) &&
675
728
  !this.#emittedFilesCacheMap.has(this.#globalStyleFilePath)
676
729
  ) {
677
730
  this.#debug(`bundle global style...`);
678
731
 
679
732
  await this.#perf.run("bundle global style", async () => {
680
- const data = FsUtil.readFile(this.#globalStyleFilePath!);
681
- const contents = await this.#bundleStylesheetAsync(data, this.#globalStyleFilePath!, this.#globalStyleFilePath);
682
- const emitFileInfos = this.#emittedFilesCacheMap.getOrCreate(this.#globalStyleFilePath!, []);
733
+ const data = FsUtils.readFile(this.#globalStyleFilePath!);
734
+ const contents = await this.#bundleStylesheetAsync(
735
+ data,
736
+ this.#globalStyleFilePath!,
737
+ this.#globalStyleFilePath,
738
+ );
739
+ const emitFileInfos = this.#emittedFilesCacheMap.getOrCreate(
740
+ this.#globalStyleFilePath!,
741
+ [],
742
+ );
683
743
  emitFileInfos.push({
684
- outAbsPath: PathUtil.norm(
744
+ outAbsPath: PathUtils.norm(
685
745
  this.#pkgPath,
686
- path.relative(path.resolve(this.#pkgPath, "src"), this.#globalStyleFilePath!).replace(/\.scss$/, ".css"),
746
+ path.relative(path.resolve(this.#pkgPath, "src"), this.#globalStyleFilePath!)
747
+ .replace(/\.scss$/, ".css"),
687
748
  ),
688
749
  text: contents,
689
750
  });
@@ -717,7 +778,7 @@ export class SdTsCompiler {
717
778
  if (!moduleSymbol) {
718
779
  const pos = ts.getLineAndCharacterOfPosition(sf, node.getStart());
719
780
  deps.push({
720
- filePath: PathUtil.norm(sf.fileName),
781
+ filePath: PathUtils.norm(sf.fileName),
721
782
  line: pos.line,
722
783
  char: pos.character,
723
784
  code: undefined,
@@ -732,7 +793,7 @@ export class SdTsCompiler {
732
793
  if (!decls) {
733
794
  const pos = ts.getLineAndCharacterOfPosition(sf, node.getStart());
734
795
  deps.push({
735
- filePath: PathUtil.norm(sf.fileName),
796
+ filePath: PathUtils.norm(sf.fileName),
736
797
  line: pos.line,
737
798
  char: pos.character,
738
799
  code: undefined,
@@ -748,7 +809,7 @@ export class SdTsCompiler {
748
809
  for (const el of namedBindings.elements) {
749
810
  for (const decl of decls) {
750
811
  deps.push({
751
- fileName: PathUtil.norm(decl.getSourceFile().fileName),
812
+ fileName: PathUtils.norm(decl.getSourceFile().fileName),
752
813
  importName: el.name.text,
753
814
  exportName: el.propertyName?.text ?? el.name.text,
754
815
  });
@@ -759,7 +820,7 @@ export class SdTsCompiler {
759
820
  if (!moduleSymbol.exports) {
760
821
  const pos = ts.getLineAndCharacterOfPosition(sf, node.getStart());
761
822
  deps.push({
762
- filePath: PathUtil.norm(sf.fileName),
823
+ filePath: PathUtils.norm(sf.fileName),
763
824
  line: pos.line,
764
825
  char: pos.character,
765
826
  code: undefined,
@@ -773,7 +834,7 @@ export class SdTsCompiler {
773
834
  for (const decl of decls) {
774
835
  for (const key of moduleSymbol.exports.keys()) {
775
836
  deps.push({
776
- fileName: PathUtil.norm(decl.getSourceFile().fileName),
837
+ fileName: PathUtils.norm(decl.getSourceFile().fileName),
777
838
  importName: key.toString(),
778
839
  exportName: key.toString(),
779
840
  });
@@ -785,9 +846,13 @@ export class SdTsCompiler {
785
846
  else if (ts.isImportDeclaration(node)) {
786
847
  const moduleSymbol = tc.getSymbolAtLocation(node.moduleSpecifier);
787
848
  if (!moduleSymbol) {
788
- if (ts.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text.startsWith("./")) {
849
+ if (ts.isStringLiteral(node.moduleSpecifier)
850
+ && node.moduleSpecifier.text.startsWith("./")) {
789
851
  deps.push({
790
- fileName: PathUtil.norm(path.resolve(path.dirname(sf.fileName), node.moduleSpecifier.text + ".ts")),
852
+ fileName: PathUtils.norm(path.resolve(
853
+ path.dirname(sf.fileName),
854
+ node.moduleSpecifier.text + ".ts",
855
+ )),
791
856
  importName: "*",
792
857
  });
793
858
 
@@ -813,7 +878,7 @@ export class SdTsCompiler {
813
878
  if (!decls) {
814
879
  const pos = ts.getLineAndCharacterOfPosition(sf, node.getStart());
815
880
  deps.push({
816
- filePath: PathUtil.norm(sf.fileName),
881
+ filePath: PathUtils.norm(sf.fileName),
817
882
  line: pos.line,
818
883
  char: pos.character,
819
884
  code: undefined,
@@ -829,7 +894,7 @@ export class SdTsCompiler {
829
894
  for (const el of namedBindings.elements) {
830
895
  for (const decl of decls) {
831
896
  deps.push({
832
- fileName: PathUtil.norm(decl.getSourceFile().fileName),
897
+ fileName: PathUtils.norm(decl.getSourceFile().fileName),
833
898
  importName: el.name.text,
834
899
  });
835
900
  }
@@ -838,7 +903,7 @@ export class SdTsCompiler {
838
903
  else {
839
904
  for (const decl of decls) {
840
905
  deps.push({
841
- fileName: PathUtil.norm(decl.getSourceFile().fileName),
906
+ fileName: PathUtils.norm(decl.getSourceFile().fileName),
842
907
  importName: "*",
843
908
  });
844
909
  }
@@ -852,7 +917,10 @@ export class SdTsCompiler {
852
917
  const moduleSymbol = tc.getSymbolAtLocation(node.arguments[0]);
853
918
  if (!moduleSymbol) {
854
919
  deps.push({
855
- fileName: PathUtil.norm(path.resolve(path.dirname(sf.fileName), node.arguments[0].text + ".ts")),
920
+ fileName: PathUtils.norm(path.resolve(
921
+ path.dirname(sf.fileName),
922
+ node.arguments[0].text + ".ts",
923
+ )),
856
924
  importName: "*",
857
925
  });
858
926
 
@@ -873,7 +941,7 @@ export class SdTsCompiler {
873
941
  if (!decls) {
874
942
  const pos = ts.getLineAndCharacterOfPosition(sf, node.getStart());
875
943
  deps.push({
876
- filePath: PathUtil.norm(sf.fileName),
944
+ filePath: PathUtils.norm(sf.fileName),
877
945
  line: pos.line,
878
946
  char: pos.character,
879
947
  code: undefined,
@@ -886,7 +954,7 @@ export class SdTsCompiler {
886
954
 
887
955
  for (const decl of decls) {
888
956
  deps.push({
889
- fileName: PathUtil.norm(decl.getSourceFile().fileName),
957
+ fileName: PathUtils.norm(decl.getSourceFile().fileName),
890
958
  importName: "*",
891
959
  });
892
960
  }
@@ -1,5 +1,5 @@
1
1
  import esbuild from "esbuild";
2
- import { TNormPath } from "@simplysm/sd-core-node";
2
+ import { type TNormPath } from "@simplysm/sd-core-node";
3
3
 
4
4
  export interface ISdCliServerPluginResultCache {
5
5
  watchFileSet?: Set<TNormPath>;
@@ -1,5 +1,5 @@
1
- import { TNormPath } from "@simplysm/sd-core-node";
2
- import { ISdProjectConfig } from "./sd-configs.type";
1
+ import { type TNormPath } from "@simplysm/sd-core-node";
2
+ import { type ISdProjectConfig } from "./config.types";
3
3
 
4
4
  export interface ISdBuildRunnerWorkerRequest {
5
5
  cmd: "watch" | "build";
@@ -1,4 +1,4 @@
1
- import { TNormPath } from "@simplysm/sd-core-node";
1
+ import { type TNormPath } from "@simplysm/sd-core-node";
2
2
 
3
3
  export interface ISdBuildRunnerResult {
4
4
  affectedFilePathSet: Set<TNormPath>;
@@ -1,7 +1,7 @@
1
- import { CompilerOptions } from "typescript";
1
+ import { type CompilerOptions } from "typescript";
2
2
  import esbuild from "esbuild";
3
- import { ISdBuildMessage } from "./build.type";
4
- import { TNormPath } from "@simplysm/sd-core-node";
3
+ import { type ISdBuildMessage } from "./build.types";
4
+ import { type TNormPath } from "@simplysm/sd-core-node";
5
5
 
6
6
  export interface SdTsCompilerOptions {
7
7
  pkgPath: TNormPath;
@@ -1,5 +1,5 @@
1
- import { ISdBuildRunnerWorkerRequest } from "./build-runner.type";
2
- import { ISdBuildMessage, ISdBuildRunnerResult } from "./build.type";
1
+ import { type ISdBuildRunnerWorkerRequest } from "./build-runner.types";
2
+ import { type ISdBuildMessage, type ISdBuildRunnerResult } from "./build.types";
3
3
 
4
4
  export interface TServerWorkerType {
5
5
  methods: {
@@ -1,12 +1,12 @@
1
1
  import ts from "typescript";
2
2
  import os from "os";
3
3
  import path from "path";
4
- import { PartialMessage } from "esbuild";
4
+ import { type PartialMessage } from "esbuild";
5
5
  import { ESLint } from "eslint";
6
- import { ISdBuildMessage } from "../types/build.type";
7
- import { PathUtil } from "@simplysm/sd-core-node";
6
+ import { type ISdBuildMessage } from "../types/build.types";
7
+ import { PathUtils } from "@simplysm/sd-core-node";
8
8
 
9
- export class SdCliConvertMessageUtil {
9
+ export class SdCliConvertMessageUtils {
10
10
  static convertToBuildMessagesFromTsDiag(diags: ts.Diagnostic[]): ISdBuildMessage[] {
11
11
  return diags.map((diag) => {
12
12
  const severity =
@@ -21,7 +21,7 @@ export class SdCliConvertMessageUtil {
21
21
  const code = `TS${diag.code}`;
22
22
  const message = ts.flattenDiagnosticMessageText(diag.messageText, os.EOL);
23
23
 
24
- const filePath = diag.file ? PathUtil.norm(path.resolve(diag.file.fileName)) : undefined;
24
+ const filePath = diag.file ? PathUtils.norm(path.resolve(diag.file.fileName)) : undefined;
25
25
  const position =
26
26
  diag.file && diag.start !== undefined ? diag.file.getLineAndCharacterOfPosition(diag.start) : undefined;
27
27
  const line = position ? position.line + 1 : undefined;
@@ -47,7 +47,7 @@ export class SdCliConvertMessageUtil {
47
47
  orgPath: string,
48
48
  ): ISdBuildMessage[] {
49
49
  const convertFn = (msg: PartialMessage, severity: "error" | "warning") => {
50
- const filePath = msg.location?.file != null ? PathUtil.norm(orgPath, msg.location.file) : undefined;
50
+ const filePath = msg.location?.file != null ? PathUtils.norm(orgPath, msg.location.file) : undefined;
51
51
  const line = msg.location?.line;
52
52
  const char = msg.location?.column;
53
53
  const code = msg.text!.slice(0, msg.text!.indexOf(":"));
@@ -73,7 +73,7 @@ export class SdCliConvertMessageUtil {
73
73
  static convertToBuildMessagesFromEslint(results: ESLint.LintResult[]): ISdBuildMessage[] {
74
74
  return results.mapMany((result) =>
75
75
  result.messages.map((msg) => ({
76
- filePath: PathUtil.norm(result.filePath),
76
+ filePath: PathUtils.norm(result.filePath),
77
77
  line: msg.line,
78
78
  char: msg.column,
79
79
  code: msg.messageId,