@simplysm/sd-cli 12.13.37 → 12.13.39

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 (121) hide show
  1. package/dist/pkg-builders/SdBuildRunnerBase.d.ts +14 -0
  2. package/dist/pkg-builders/SdBuildRunnerBase.js +23 -0
  3. package/dist/pkg-builders/SdBuildRunnerBase.js.map +1 -0
  4. package/dist/pkg-builders/SdProjectBuildRunner.js +18 -14
  5. package/dist/pkg-builders/SdProjectBuildRunner.js.map +1 -1
  6. package/dist/pkg-builders/client/SdClientBuildRunner.d.ts +1 -1
  7. package/dist/pkg-builders/client/SdClientBuildRunner.js +17 -36
  8. package/dist/pkg-builders/client/SdClientBuildRunner.js.map +1 -1
  9. package/dist/pkg-builders/client/SdNgBundler.d.ts +10 -16
  10. package/dist/pkg-builders/client/SdNgBundler.js +59 -54
  11. package/dist/pkg-builders/client/SdNgBundler.js.map +1 -1
  12. package/dist/pkg-builders/client/createSdNgPlugin.d.ts +2 -11
  13. package/dist/pkg-builders/client/createSdNgPlugin.js +16 -25
  14. package/dist/pkg-builders/client/createSdNgPlugin.js.map +1 -1
  15. package/dist/pkg-builders/lib/SdJsLibBuildRunner.d.ts +1 -1
  16. package/dist/pkg-builders/lib/SdJsLibBuildRunner.js +5 -5
  17. package/dist/pkg-builders/lib/SdJsLibBuildRunner.js.map +1 -1
  18. package/dist/pkg-builders/lib/SdTsLibBuildRunner.d.ts +1 -1
  19. package/dist/pkg-builders/lib/SdTsLibBuildRunner.js +6 -6
  20. package/dist/pkg-builders/lib/SdTsLibBuildRunner.js.map +1 -1
  21. package/dist/pkg-builders/lib/SdTsLibBuilder.d.ts +3 -3
  22. package/dist/pkg-builders/lib/SdTsLibBuilder.js +6 -15
  23. package/dist/pkg-builders/lib/SdTsLibBuilder.js.map +1 -1
  24. package/dist/pkg-builders/server/SdServerBuildRunner.d.ts +1 -1
  25. package/dist/pkg-builders/server/SdServerBuildRunner.js +25 -42
  26. package/dist/pkg-builders/server/SdServerBuildRunner.js.map +1 -1
  27. package/dist/pkg-builders/server/SdServerBundler.d.ts +4 -10
  28. package/dist/pkg-builders/server/SdServerBundler.js +15 -22
  29. package/dist/pkg-builders/server/SdServerBundler.js.map +1 -1
  30. package/dist/pkg-builders/server/createSdServerPlugin.d.ts +2 -11
  31. package/dist/pkg-builders/server/createSdServerPlugin.js +10 -19
  32. package/dist/pkg-builders/server/createSdServerPlugin.js.map +1 -1
  33. package/dist/sd-cli-entry.js +1 -1
  34. package/dist/sd-cli-entry.js.map +1 -1
  35. package/dist/ts-compiler/ScopePathSet.js.map +1 -0
  36. package/dist/ts-compiler/SdDepAnalyzer.d.ts +1 -1
  37. package/dist/ts-compiler/SdStyleBundler.d.ts +8 -5
  38. package/dist/ts-compiler/SdStyleBundler.js +30 -15
  39. package/dist/ts-compiler/SdStyleBundler.js.map +1 -1
  40. package/dist/ts-compiler/SdTsCompiler.d.ts +2 -1
  41. package/dist/ts-compiler/SdTsCompiler.js +68 -53
  42. package/dist/ts-compiler/SdTsCompiler.js.map +1 -1
  43. package/dist/types/build/ISdTsCompilerOptions.d.ts +6 -9
  44. package/dist/types/worker/ISdBuildRunnerWorkerType.d.ts +4 -7
  45. package/dist/workers/build-runner.worker.js +4 -5
  46. package/dist/workers/build-runner.worker.js.map +1 -1
  47. package/package.json +5 -5
  48. package/src/pkg-builders/SdBuildRunnerBase.ts +36 -0
  49. package/src/pkg-builders/SdProjectBuildRunner.ts +24 -16
  50. package/src/pkg-builders/client/SdClientBuildRunner.ts +25 -46
  51. package/src/pkg-builders/client/SdNgBundler.ts +69 -73
  52. package/src/pkg-builders/client/createSdNgPlugin.ts +21 -35
  53. package/src/pkg-builders/lib/SdJsLibBuildRunner.ts +5 -5
  54. package/src/pkg-builders/lib/SdTsLibBuildRunner.ts +9 -13
  55. package/src/pkg-builders/lib/SdTsLibBuilder.ts +7 -23
  56. package/src/pkg-builders/server/SdServerBuildRunner.ts +32 -50
  57. package/src/pkg-builders/server/SdServerBundler.ts +16 -32
  58. package/src/pkg-builders/server/createSdServerPlugin.ts +15 -29
  59. package/src/sd-cli-entry.ts +1 -1
  60. package/src/ts-compiler/SdDepAnalyzer.ts +1 -1
  61. package/src/ts-compiler/SdStyleBundler.ts +34 -15
  62. package/src/ts-compiler/SdTsCompiler.ts +75 -63
  63. package/src/types/build/ISdTsCompilerOptions.ts +6 -9
  64. package/src/types/worker/ISdBuildRunnerWorkerType.ts +4 -9
  65. package/src/workers/build-runner.worker.ts +7 -16
  66. package/dist/fix/convert-extends-sd-modal-base-to-interface.d.ts +0 -1
  67. package/dist/fix/convert-extends-sd-modal-base-to-interface.js +0 -289
  68. package/dist/fix/convert-extends-sd-modal-base-to-interface.js.map +0 -1
  69. package/dist/fix/convert-extends-sd-print-template-base-to-interface.d.ts +0 -1
  70. package/dist/fix/convert-extends-sd-print-template-base-to-interface.js +0 -179
  71. package/dist/fix/convert-extends-sd-print-template-base-to-interface.js.map +0 -1
  72. package/dist/fix/convert-flat-pages-to-flat-menus.d.ts +0 -1
  73. package/dist/fix/convert-flat-pages-to-flat-menus.js +0 -68
  74. package/dist/fix/convert-flat-pages-to-flat-menus.js.map +0 -1
  75. package/dist/fix/convert-get-menus-to-usable-menus.d.ts +0 -1
  76. package/dist/fix/convert-get-menus-to-usable-menus.js +0 -48
  77. package/dist/fix/convert-get-menus-to-usable-menus.js.map +0 -1
  78. package/dist/fix/convert-modal-show-params.d.ts +0 -1
  79. package/dist/fix/convert-modal-show-params.js +0 -29
  80. package/dist/fix/convert-modal-show-params.js.map +0 -1
  81. package/dist/fix/convert-print-params.d.ts +0 -1
  82. package/dist/fix/convert-print-params.js +0 -37
  83. package/dist/fix/convert-print-params.js.map +0 -1
  84. package/dist/fix/convert-sd-icon-to-fa-icon.d.ts +0 -1
  85. package/dist/fix/convert-sd-icon-to-fa-icon.js +0 -80
  86. package/dist/fix/convert-sd-icon-to-fa-icon.js.map +0 -1
  87. package/dist/fix/convert-sd-sheet-bindings-safety.d.ts +0 -1
  88. package/dist/fix/convert-sd-sheet-bindings-safety.js +0 -57
  89. package/dist/fix/convert-sd-sheet-bindings-safety.js.map +0 -1
  90. package/dist/fix/convert-select-modal-button-to-select-button.d.ts +0 -1
  91. package/dist/fix/convert-select-modal-button-to-select-button.js +0 -64
  92. package/dist/fix/convert-select-modal-button-to-select-button.js.map +0 -1
  93. package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.d.ts +0 -1
  94. package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.js +0 -38
  95. package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.js.map +0 -1
  96. package/dist/fix/convert-to-use-perms-signal.d.ts +0 -1
  97. package/dist/fix/convert-to-use-perms-signal.js +0 -99
  98. package/dist/fix/convert-to-use-perms-signal.js.map +0 -1
  99. package/dist/fix/core/remove-named-import.d.ts +0 -1
  100. package/dist/fix/core/remove-named-import.js +0 -14
  101. package/dist/fix/core/remove-named-import.js.map +0 -1
  102. package/dist/pkg-builders/commons/ScopePathSet.js.map +0 -1
  103. package/dist/pkg-builders/commons/SdBuildRunnerBase.d.ts +0 -20
  104. package/dist/pkg-builders/commons/SdBuildRunnerBase.js +0 -30
  105. package/dist/pkg-builders/commons/SdBuildRunnerBase.js.map +0 -1
  106. package/src/fix/convert-extends-sd-modal-base-to-interface.ts +0 -324
  107. package/src/fix/convert-extends-sd-print-template-base-to-interface.ts +0 -201
  108. package/src/fix/convert-flat-pages-to-flat-menus.ts +0 -83
  109. package/src/fix/convert-get-menus-to-usable-menus.ts +0 -60
  110. package/src/fix/convert-modal-show-params.ts +0 -37
  111. package/src/fix/convert-print-params.ts +0 -51
  112. package/src/fix/convert-sd-icon-to-fa-icon.ts +0 -95
  113. package/src/fix/convert-sd-sheet-bindings-safety.ts +0 -73
  114. package/src/fix/convert-select-modal-button-to-select-button.ts +0 -91
  115. package/src/fix/convert-setup-cumulate-selected-keys-to-object-param.ts +0 -44
  116. package/src/fix/convert-to-use-perms-signal.ts +0 -133
  117. package/src/fix/core/remove-named-import.ts +0 -14
  118. package/src/pkg-builders/commons/SdBuildRunnerBase.ts +0 -47
  119. /package/dist/{pkg-builders/commons → ts-compiler}/ScopePathSet.d.ts +0 -0
  120. /package/dist/{pkg-builders/commons → ts-compiler}/ScopePathSet.js +0 -0
  121. /package/src/{pkg-builders/commons → ts-compiler}/ScopePathSet.ts +0 -0
@@ -14,11 +14,13 @@ import { FlatESLint } from "eslint/use-at-your-own-risk";
14
14
  import { SdStyleBundler } from "./SdStyleBundler";
15
15
  import { ISdTsCompilerOptions } from "../types/build/ISdTsCompilerOptions";
16
16
  import { ISdTsCompilerResult } from "../types/build/ISdTsCompilerResult";
17
+ import { ScopePathSet } from "./ScopePathSet";
17
18
 
18
19
  export class SdTsCompiler {
19
20
  #logger = SdLogger.get(["simplysm", "sd-cli", "SdTsCompiler"]);
20
21
 
21
22
  #isForAngular: boolean;
23
+ #scopePathSet: ScopePathSet;
22
24
 
23
25
  #styleBundler: SdStyleBundler | undefined;
24
26
 
@@ -44,19 +46,24 @@ export class SdTsCompiler {
44
46
 
45
47
  #perf!: SdCliPerformanceTimer;
46
48
 
47
- constructor(private readonly _opt: ISdTsCompilerOptions) {
49
+ constructor(
50
+ private readonly _opt: ISdTsCompilerOptions,
51
+ private readonly _forBundle: boolean,
52
+ ) {
48
53
  this.#debug("초기화 중...");
49
54
 
50
55
  const tsconfigPath = path.resolve(this._opt.pkgPath, "tsconfig.json");
51
56
  const tsconfig = FsUtils.readJson(tsconfigPath);
52
57
  this.#isForAngular = Boolean(tsconfig.angularCompilerOptions);
53
58
 
54
- if (!this._opt.isNoEmit) {
55
- this.#styleBundler = new SdStyleBundler(
56
- this._opt.pkgPath,
57
- this._opt.isDevMode,
58
- this._opt.scopePathSet,
59
- );
59
+ this.#scopePathSet = new ScopePathSet(this._opt.scopePathSet);
60
+
61
+ if (!this._opt.watch?.noEmit) {
62
+ this.#styleBundler = new SdStyleBundler({
63
+ pkgPath: this._opt.pkgPath,
64
+ scopePathSet: this.#scopePathSet,
65
+ dev: !!this._opt.watch?.dev,
66
+ });
60
67
  }
61
68
  }
62
69
 
@@ -65,8 +72,8 @@ export class SdTsCompiler {
65
72
  const tsconfig = FsUtils.readJson(tsconfigPath);
66
73
  const parsedTsconfig = ts.parseJsonConfigFileContent(tsconfig, ts.sys, this._opt.pkgPath, {
67
74
  ...tsconfig.angularCompilerOptions,
68
- ...this._opt.additionalOptions,
69
- ...(this._opt.isEmitOnly
75
+ ...(this._forBundle ? { declaration: false } : {}),
76
+ ...(this._opt.watch?.emitOnly
70
77
  ? {
71
78
  // typescript
72
79
  noEmitOnError: false,
@@ -153,7 +160,7 @@ export class SdTsCompiler {
153
160
  return compilerHost.readFile(fileName) ?? "";
154
161
  };
155
162
 
156
- if (!this._opt.isNoEmit) {
163
+ if (!this._opt.watch?.noEmit) {
157
164
  (compilerHost as AngularCompilerHost).transformResource = async (
158
165
  data: string,
159
166
  context: {
@@ -192,19 +199,23 @@ export class SdTsCompiler {
192
199
  const prepareResult = await this.#prepareAsync(modifiedFileSet);
193
200
 
194
201
  const [globalStyleSheet, buildResult, lintResults] = await Promise.all([
195
- this._opt.isNoEmit ? undefined : this.#buildGlobalStyleAsync(),
202
+ this._opt.watch?.noEmit ? undefined : this.#buildGlobalStyleAsync(),
196
203
  this.#build(prepareResult),
197
- this._opt.isEmitOnly ? [] : this.#lintAsync(prepareResult),
204
+ this._opt.watch?.emitOnly ? [] : this.#lintAsync(prepareResult),
198
205
  ]);
199
206
 
200
207
  const affectedFileSet = new Set([
201
208
  ...prepareResult.affectedFileSet,
202
- ...prepareResult.styleAffectedFileSet,
209
+ ...(this.#styleBundler?.getAffectedFileSet(modifiedFileSet) ?? []),
210
+ ]);
211
+ const watchFileSet = new Set([
212
+ ...prepareResult.watchFileSet,
213
+ ...(this.#styleBundler?.getAllStyleFileSet() ?? []),
203
214
  ]);
204
215
 
205
216
  this.#debug(`빌드 완료됨`, this.#perf.toString());
206
- this.#debug(`영향 받은 파일: ${affectedFileSet.size}개`);
207
- this.#debug(`감시 중인 파일: ${prepareResult.watchFileSet.size}개`);
217
+ this.#debug(`영향 받은 파일: ${affectedFileSet.size}개`, affectedFileSet);
218
+ this.#debug(`감시 중인 파일: ${watchFileSet.size}개`);
208
219
 
209
220
  return {
210
221
  messages: [
@@ -212,7 +223,7 @@ export class SdTsCompiler {
212
223
  ...SdCliConvertMessageUtils.convertToBuildMessagesFromEslint(lintResults),
213
224
  ],
214
225
  affectedFileSet: affectedFileSet,
215
- watchFileSet: prepareResult.watchFileSet,
226
+ watchFileSet: watchFileSet,
216
227
  stylesheetBundlingResultMap: this.#styleBundler?.getResultCache() ?? new Map(),
217
228
  emittedFilesCacheMap: this.#emittedFilesCacheMap,
218
229
  emitFileSet: new Set([...buildResult.emitFileSet, globalStyleSheet].filterExists()),
@@ -220,11 +231,9 @@ export class SdTsCompiler {
220
231
  }
221
232
 
222
233
  async #prepareAsync(modifiedFileSet: Set<TNormPath>): Promise<IPrepareResult> {
223
- // const worker = await this._getOrCreateStyleBundleWorkerAsync();
224
-
225
234
  const tsconfig = this.#parseTsConfig();
226
235
 
227
- if (modifiedFileSet.size !== 0 && this._opt.isWatchMode) {
236
+ if (modifiedFileSet.size !== 0 && this._opt.watch) {
228
237
  this.#debug(`캐시 무효화 및 초기화 중...`);
229
238
 
230
239
  // this._perf.run("캐시 무효화 및 초기화", () => {
@@ -237,9 +246,10 @@ export class SdTsCompiler {
237
246
  // 스타일 번들러 무효화 (transformResource 재실행 땜에 필요할듯)
238
247
  if (this.#styleBundler) {
239
248
  const styleAffectedFileSet = this.#styleBundler.invalidate(modifiedFileSet);
240
- // 스타일 변경된 파일들로 소스파일 무효화
249
+ // 스타일 변경된 파일들로 무효화
241
250
  for (const styleAffectedFile of styleAffectedFileSet) {
242
251
  this.#sourceFileCacheMap.delete(styleAffectedFile);
252
+ this.#emittedFilesCacheMap.delete(styleAffectedFile);
243
253
  }
244
254
  }
245
255
 
@@ -249,14 +259,7 @@ export class SdTsCompiler {
249
259
  }
250
260
 
251
261
  // 기존 의존성에 의해 영향받는 파일들 계산
252
- const affectedFileMap = this.#cache.dep.getAffectedFileMap(modifiedFileSet);
253
- const affectedFileSet = new Set(
254
- Array.from(affectedFileMap.values()).mapMany((item) => Array.from(item)),
255
- );
256
-
257
- // 의존성 캐시에서 영향받은 파일 관련 항목 무효화 (Affected더라도 SF는 동일하므로, modifiedFileSet만 넣어도될듯?)
258
- // 250715: sourceFile 타입체크를 다시 해야해서 affected로 넣는게 맞는듯.
259
- this.#cache.dep.invalidates(affectedFileSet);
262
+ this.#cache.dep.invalidates(modifiedFileSet);
260
263
 
261
264
  // 결과물이 바뀌어야 하는 캐시 모두 무효화 (modified만 다시쓰면될듯..)
262
265
  for (const modifiedFile of modifiedFileSet) {
@@ -289,50 +292,50 @@ export class SdTsCompiler {
289
292
  );
290
293
  }
291
294
  });
292
- this.#debug(`ts.Program 생성`);
293
295
 
294
296
  if (this.#ngProgram) {
297
+ this.#debug(`Angular 템플릿 분석...`);
298
+
295
299
  await this.#perf.run("Angular 템플릿 분석", async () => {
296
300
  await this.#ngProgram!.compiler.analyzeAsync();
297
301
  });
298
302
  }
299
303
 
300
- if (!this._opt.isEmitOnly && this._opt.isWatchMode) {
304
+ if (!this._opt.watch?.emitOnly && this._opt.watch) {
301
305
  this.#debug(`새 의존성 분석 중...`);
302
306
 
303
307
  this.#perf.run("새 의존성 분석", () => {
304
308
  // SdTsDependencyAnalyzer를 통해 의존성 분석 및 SdDepCache 업데이트
305
- SdDepAnalyzer.analyze(this.#program!, compilerHost, this._opt.scopePathSet, this.#cache);
309
+ SdDepAnalyzer.analyze(this.#program!, compilerHost, this.#scopePathSet, this.#cache);
306
310
  });
307
311
 
308
- this.#debug(`새 의존성 분석(Angular) 중...`);
309
-
310
312
  // Angular 리소스 의존성 추가
311
313
  if (this.#ngProgram) {
314
+ this.#debug(`새 의존성 분석(Angular) 중...`);
315
+
312
316
  this.#perf.run("새 의존성 분석(Angular)", () => {
313
317
  SdDepAnalyzer.analyzeAngularResources(
314
318
  this.#ngProgram!,
315
- this._opt.scopePathSet,
319
+ this.#scopePathSet,
316
320
  this.#cache.dep,
317
321
  );
318
322
  });
319
323
  }
320
324
  }
321
325
 
322
- const allFiles = this.#program!.getSourceFiles().mapMany((item) => [
326
+ const allTsFiles = this.#program!.getSourceFiles().mapMany((item) => [
323
327
  PathUtils.norm(item.fileName),
324
328
  ...(item.fileName.endsWith(".d.ts")
325
329
  ? [PathUtils.norm(item.fileName.replace(/\.d\.ts$/, "") + ".js")]
326
330
  : []),
327
331
  ]);
328
- const watchFileSet = new Set(allFiles.filter((item) => this._opt.scopePathSet.inScope(item)));
332
+ const watchFileSet = new Set(allTsFiles.filter((item) => this.#scopePathSet.inScope(item)));
329
333
 
330
334
  let affectedFileSet: Set<TNormPath>;
331
335
  if (modifiedFileSet.size === 0) {
332
- affectedFileSet = new Set(allFiles.filter((item) => this._opt.scopePathSet.inScope(item)));
336
+ affectedFileSet = new Set(allTsFiles.filter((item) => this.#scopePathSet.inScope(item)));
333
337
  } else {
334
338
  const affectedFileMap = this.#cache.dep.getAffectedFileMap(modifiedFileSet);
335
- this.#debug("영향받은 파일:", affectedFileMap);
336
339
  affectedFileSet = new Set(
337
340
  Array.from(affectedFileMap.values()).mapMany((item) => Array.from(item)),
338
341
  );
@@ -341,42 +344,48 @@ export class SdTsCompiler {
341
344
  return {
342
345
  tsconfig,
343
346
  compilerHost,
344
- affectedFileSet,
345
- styleAffectedFileSet: this.#styleBundler?.getAffectedFileSet(affectedFileSet) ?? new Set(),
346
347
  watchFileSet,
348
+ affectedFileSet,
349
+ styleAffectedFileSet: this.#styleBundler?.getAffectedFileSet(modifiedFileSet) ?? new Set(),
347
350
  };
348
351
  }
349
352
 
350
353
  async #lintAsync(prepareResult: IPrepareResult) {
351
- const lintFilePaths = Array.from(prepareResult.affectedFileSet)
352
- .filter((item) => PathUtils.isChildPath(item, this._opt.pkgPath))
353
- .filter((item) => (!item.endsWith(".d.ts") && item.endsWith(".ts")) || item.endsWith(".js"))
354
- .filter((item) => FsUtils.exists(item));
354
+ return await this.#perf.run("Linting", async () => {
355
+ this.#debug(`Linting...`);
355
356
 
356
- if (lintFilePaths.length === 0) {
357
- return [];
358
- }
357
+ const lintFilePaths = Array.from(prepareResult.affectedFileSet)
358
+ .filter((item) => PathUtils.isChildPath(item, this._opt.pkgPath))
359
+ .filter((item) => (!item.endsWith(".d.ts") && item.endsWith(".ts")) || item.endsWith(".js"))
360
+ .filter((item) => FsUtils.exists(item));
361
+
362
+ if (lintFilePaths.length === 0) {
363
+ return [];
364
+ }
359
365
 
360
- const linter = new FlatESLint({
361
- cwd: this._opt.pkgPath,
362
- cache: false,
363
- overrideConfig: {
364
- languageOptions: {
365
- parserOptions: {
366
- project: null,
367
- programs: [this.#program],
366
+ const linter = new FlatESLint({
367
+ cwd: this._opt.pkgPath,
368
+ cache: false,
369
+ overrideConfig: {
370
+ languageOptions: {
371
+ parserOptions: {
372
+ project: null,
373
+ programs: [this.#program],
374
+ },
368
375
  },
369
376
  },
370
- },
377
+ });
378
+ const result = await linter.lintFiles(lintFilePaths);
379
+ this.#debug(`Linting 완료`);
380
+ return result;
371
381
  });
372
- return await linter.lintFiles(lintFilePaths);
373
382
  }
374
383
 
375
384
  async #buildGlobalStyleAsync() {
376
385
  if (!this.#isForAngular) return;
377
386
 
378
387
  //-- global style
379
- const globalStyleFilePath = PathUtils.norm(this._opt.pkgPath, "src/styles.scss");
388
+ const globalStyleFilePath = PathUtils.norm(this._opt.pkgPath, "scss/styles.scss");
380
389
  if (this.#emittedFilesCacheMap.has(globalStyleFilePath)) return;
381
390
  if (!FsUtils.exists(globalStyleFilePath)) return;
382
391
 
@@ -394,7 +403,7 @@ export class SdTsCompiler {
394
403
  outAbsPath: PathUtils.norm(
395
404
  this._opt.pkgPath,
396
405
  path
397
- .relative(path.resolve(this._opt.pkgPath, "src"), globalStyleFilePath)
406
+ .relative(path.resolve(this._opt.pkgPath, "scss"), globalStyleFilePath)
398
407
  .replace(/\.scss$/, ".css"),
399
408
  ),
400
409
  text: stylesheetBundlingResult.contents ?? "",
@@ -408,7 +417,7 @@ export class SdTsCompiler {
408
417
  const emitFileSet = new Set<TNormPath>();
409
418
  const diagnostics: ts.Diagnostic[] = [];
410
419
 
411
- if (!this._opt.isEmitOnly) {
420
+ if (!this._opt.watch?.emitOnly) {
412
421
  this.#debug(`프로그램 진단 수집 중...`);
413
422
 
414
423
  this.#perf.run("프로그램 진단 수집", () => {
@@ -458,7 +467,7 @@ export class SdTsCompiler {
458
467
  }
459
468
  }
460
469
 
461
- if (!this._opt.isNoEmit) {
470
+ if (!this._opt.watch?.noEmit) {
462
471
  this.#perf.run("파일 출력 (emit)", () => {
463
472
  this.#debug(`파일 출력 준비 중...`);
464
473
 
@@ -493,6 +502,7 @@ export class SdTsCompiler {
493
502
  ...prepareResult.affectedFileSet,
494
503
  ...prepareResult.styleAffectedFileSet,
495
504
  ]) {
505
+ if (affectedFile.endsWith(".scss")) continue;
496
506
  if (
497
507
  this.#emittedFilesCacheMap
498
508
  .get(affectedFile)
@@ -507,7 +517,7 @@ export class SdTsCompiler {
507
517
 
508
518
  // 번들이 아닌 외부패키지는 보통 emit안해도 됨
509
519
  // but esbuild를 통해 bundle로 묶어야 하는놈들은 모든 output이 있어야 함.
510
- if (!this._opt.isForBundle && !PathUtils.isChildPath(sf.fileName, this._opt.pkgPath)) {
520
+ if (!this._forBundle && !PathUtils.isChildPath(sf.fileName, this._opt.pkgPath)) {
511
521
  continue;
512
522
  }
513
523
 
@@ -559,6 +569,8 @@ export class SdTsCompiler {
559
569
  transformers,
560
570
  );
561
571
  }
572
+
573
+ this.#debug(`파일 출력 완료`);
562
574
  });
563
575
  }
564
576
 
@@ -609,7 +621,7 @@ interface ITsConfigInfo {
609
621
  interface IPrepareResult {
610
622
  tsconfig: ITsConfigInfo;
611
623
  compilerHost: ts.CompilerHost;
624
+ watchFileSet: Set<TNormPath>;
612
625
  affectedFileSet: Set<TNormPath>;
613
626
  styleAffectedFileSet: Set<TNormPath>;
614
- watchFileSet: Set<TNormPath>;
615
627
  }
@@ -1,14 +1,11 @@
1
1
  import { TNormPath } from "@simplysm/sd-core-node";
2
- import ts from "typescript";
3
- import { ScopePathSet } from "../../pkg-builders/commons/ScopePathSet";
4
2
 
5
3
  export interface ISdTsCompilerOptions {
6
4
  pkgPath: TNormPath;
7
- additionalOptions: ts.CompilerOptions;
8
- isForBundle: boolean;
9
- isWatchMode: boolean;
10
- isDevMode: boolean;
11
- isEmitOnly: boolean;
12
- isNoEmit: boolean;
13
- scopePathSet: ScopePathSet;
5
+ scopePathSet: Set<TNormPath>;
6
+ watch?: {
7
+ dev: boolean;
8
+ emitOnly: boolean;
9
+ noEmit: boolean;
10
+ };
14
11
  }
@@ -1,6 +1,7 @@
1
1
  import { ISdBuildResult } from "../build/ISdBuildResult";
2
2
  import { ISdWorkerType, TNormPath } from "@simplysm/sd-core-node";
3
- import { ISdProjectConfig } from "../config/ISdProjectConfig";
3
+ import { TSdPackageConfig } from "../config/ISdProjectConfig";
4
+ import { ISdTsCompilerOptions } from "../build/ISdTsCompilerOptions";
4
5
 
5
6
  export interface ISdBuildRunnerWorkerType extends ISdWorkerType {
6
7
  methods: {
@@ -13,12 +14,6 @@ export interface ISdBuildRunnerWorkerType extends ISdWorkerType {
13
14
  }
14
15
 
15
16
  export interface ISdBuildRunnerInitializeRequest {
16
- pkgPath: TNormPath;
17
- projConf: ISdProjectConfig;
18
- scopePathSet: Set<TNormPath>;
19
-
20
- // watch
21
- watch?: boolean;
22
- emitOnly?: boolean;
23
- noEmit?: boolean;
17
+ options: ISdTsCompilerOptions;
18
+ pkgConf: TSdPackageConfig<any>;
24
19
  }
@@ -11,11 +11,12 @@ import {
11
11
  ISdBuildRunnerInitializeRequest,
12
12
  ISdBuildRunnerWorkerType,
13
13
  } from "../types/worker/ISdBuildRunnerWorkerType";
14
- import { SdBuildRunnerBase } from "../pkg-builders/commons/SdBuildRunnerBase";
14
+ import { SdBuildRunnerBase } from "../pkg-builders/SdBuildRunnerBase";
15
15
  import { SdServerBuildRunner } from "../pkg-builders/server/SdServerBuildRunner";
16
16
  import { SdClientBuildRunner } from "../pkg-builders/client/SdClientBuildRunner";
17
17
  import { SdTsLibBuildRunner } from "../pkg-builders/lib/SdTsLibBuildRunner";
18
18
  import { SdJsLibBuildRunner } from "../pkg-builders/lib/SdJsLibBuildRunner";
19
+ import { Type } from "@simplysm/sd-core-common";
19
20
 
20
21
  Error.stackTraceLimit = Infinity;
21
22
  EventEmitter.defaultMaxListeners = 0;
@@ -36,26 +37,16 @@ let buildRunner: SdBuildRunnerBase<any>;
36
37
 
37
38
  createSdWorker<ISdBuildRunnerWorkerType>({
38
39
  initialize(req: ISdBuildRunnerInitializeRequest) {
39
- const pkgConf = req.projConf.packages[path.basename(req.pkgPath)]!;
40
-
41
- const buildRunnerType =
42
- pkgConf.type === "server"
40
+ const buildRunnerType: Type<SdBuildRunnerBase<any>> =
41
+ req.pkgConf.type === "server"
43
42
  ? SdServerBuildRunner
44
- : pkgConf.type === "client"
43
+ : req.pkgConf.type === "client"
45
44
  ? SdClientBuildRunner
46
- : FsUtils.exists(path.resolve(req.pkgPath, "tsconfig.json"))
45
+ : FsUtils.exists(path.resolve(req.options.pkgPath, "tsconfig.json"))
47
46
  ? SdTsLibBuildRunner
48
47
  : SdJsLibBuildRunner;
49
48
 
50
- buildRunner = new buildRunnerType(
51
- req.pkgPath,
52
- req.projConf,
53
- req.scopePathSet,
54
- req.watch ?? false,
55
- req.watch ? !pkgConf.forceProductionMode : false,
56
- req.emitOnly,
57
- req.noEmit,
58
- );
49
+ buildRunner = new buildRunnerType(req.options, req.pkgConf);
59
50
  },
60
51
  async rebuild(modifiedFileSet?: Set<TNormPath>) {
61
52
  return await buildRunner.rebuildAsync(modifiedFileSet);
@@ -1 +0,0 @@
1
- export declare function convertExtendsSdModalBaseToInterface(): void;