@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.
- package/dist/pkg-builders/SdBuildRunnerBase.d.ts +14 -0
- package/dist/pkg-builders/SdBuildRunnerBase.js +23 -0
- package/dist/pkg-builders/SdBuildRunnerBase.js.map +1 -0
- package/dist/pkg-builders/SdProjectBuildRunner.js +18 -14
- package/dist/pkg-builders/SdProjectBuildRunner.js.map +1 -1
- package/dist/pkg-builders/client/SdClientBuildRunner.d.ts +1 -1
- package/dist/pkg-builders/client/SdClientBuildRunner.js +17 -36
- package/dist/pkg-builders/client/SdClientBuildRunner.js.map +1 -1
- package/dist/pkg-builders/client/SdNgBundler.d.ts +10 -16
- package/dist/pkg-builders/client/SdNgBundler.js +59 -54
- package/dist/pkg-builders/client/SdNgBundler.js.map +1 -1
- package/dist/pkg-builders/client/createSdNgPlugin.d.ts +2 -11
- package/dist/pkg-builders/client/createSdNgPlugin.js +16 -25
- package/dist/pkg-builders/client/createSdNgPlugin.js.map +1 -1
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.d.ts +1 -1
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js +5 -5
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js.map +1 -1
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.d.ts +1 -1
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js +6 -6
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js.map +1 -1
- package/dist/pkg-builders/lib/SdTsLibBuilder.d.ts +3 -3
- package/dist/pkg-builders/lib/SdTsLibBuilder.js +6 -15
- package/dist/pkg-builders/lib/SdTsLibBuilder.js.map +1 -1
- package/dist/pkg-builders/server/SdServerBuildRunner.d.ts +1 -1
- package/dist/pkg-builders/server/SdServerBuildRunner.js +25 -42
- package/dist/pkg-builders/server/SdServerBuildRunner.js.map +1 -1
- package/dist/pkg-builders/server/SdServerBundler.d.ts +4 -10
- package/dist/pkg-builders/server/SdServerBundler.js +15 -22
- package/dist/pkg-builders/server/SdServerBundler.js.map +1 -1
- package/dist/pkg-builders/server/createSdServerPlugin.d.ts +2 -11
- package/dist/pkg-builders/server/createSdServerPlugin.js +10 -19
- package/dist/pkg-builders/server/createSdServerPlugin.js.map +1 -1
- package/dist/sd-cli-entry.js +1 -1
- package/dist/sd-cli-entry.js.map +1 -1
- package/dist/ts-compiler/ScopePathSet.js.map +1 -0
- package/dist/ts-compiler/SdDepAnalyzer.d.ts +1 -1
- package/dist/ts-compiler/SdStyleBundler.d.ts +8 -5
- package/dist/ts-compiler/SdStyleBundler.js +30 -15
- package/dist/ts-compiler/SdStyleBundler.js.map +1 -1
- package/dist/ts-compiler/SdTsCompiler.d.ts +2 -1
- package/dist/ts-compiler/SdTsCompiler.js +68 -53
- package/dist/ts-compiler/SdTsCompiler.js.map +1 -1
- package/dist/types/build/ISdTsCompilerOptions.d.ts +6 -9
- package/dist/types/worker/ISdBuildRunnerWorkerType.d.ts +4 -7
- package/dist/workers/build-runner.worker.js +4 -5
- package/dist/workers/build-runner.worker.js.map +1 -1
- package/package.json +5 -5
- package/src/pkg-builders/SdBuildRunnerBase.ts +36 -0
- package/src/pkg-builders/SdProjectBuildRunner.ts +24 -16
- package/src/pkg-builders/client/SdClientBuildRunner.ts +25 -46
- package/src/pkg-builders/client/SdNgBundler.ts +69 -73
- package/src/pkg-builders/client/createSdNgPlugin.ts +21 -35
- package/src/pkg-builders/lib/SdJsLibBuildRunner.ts +5 -5
- package/src/pkg-builders/lib/SdTsLibBuildRunner.ts +9 -13
- package/src/pkg-builders/lib/SdTsLibBuilder.ts +7 -23
- package/src/pkg-builders/server/SdServerBuildRunner.ts +32 -50
- package/src/pkg-builders/server/SdServerBundler.ts +16 -32
- package/src/pkg-builders/server/createSdServerPlugin.ts +15 -29
- package/src/sd-cli-entry.ts +1 -1
- package/src/ts-compiler/SdDepAnalyzer.ts +1 -1
- package/src/ts-compiler/SdStyleBundler.ts +34 -15
- package/src/ts-compiler/SdTsCompiler.ts +75 -63
- package/src/types/build/ISdTsCompilerOptions.ts +6 -9
- package/src/types/worker/ISdBuildRunnerWorkerType.ts +4 -9
- package/src/workers/build-runner.worker.ts +7 -16
- package/dist/fix/convert-extends-sd-modal-base-to-interface.d.ts +0 -1
- package/dist/fix/convert-extends-sd-modal-base-to-interface.js +0 -289
- package/dist/fix/convert-extends-sd-modal-base-to-interface.js.map +0 -1
- package/dist/fix/convert-extends-sd-print-template-base-to-interface.d.ts +0 -1
- package/dist/fix/convert-extends-sd-print-template-base-to-interface.js +0 -179
- package/dist/fix/convert-extends-sd-print-template-base-to-interface.js.map +0 -1
- package/dist/fix/convert-flat-pages-to-flat-menus.d.ts +0 -1
- package/dist/fix/convert-flat-pages-to-flat-menus.js +0 -68
- package/dist/fix/convert-flat-pages-to-flat-menus.js.map +0 -1
- package/dist/fix/convert-get-menus-to-usable-menus.d.ts +0 -1
- package/dist/fix/convert-get-menus-to-usable-menus.js +0 -48
- package/dist/fix/convert-get-menus-to-usable-menus.js.map +0 -1
- package/dist/fix/convert-modal-show-params.d.ts +0 -1
- package/dist/fix/convert-modal-show-params.js +0 -29
- package/dist/fix/convert-modal-show-params.js.map +0 -1
- package/dist/fix/convert-print-params.d.ts +0 -1
- package/dist/fix/convert-print-params.js +0 -37
- package/dist/fix/convert-print-params.js.map +0 -1
- package/dist/fix/convert-sd-icon-to-fa-icon.d.ts +0 -1
- package/dist/fix/convert-sd-icon-to-fa-icon.js +0 -80
- package/dist/fix/convert-sd-icon-to-fa-icon.js.map +0 -1
- package/dist/fix/convert-sd-sheet-bindings-safety.d.ts +0 -1
- package/dist/fix/convert-sd-sheet-bindings-safety.js +0 -57
- package/dist/fix/convert-sd-sheet-bindings-safety.js.map +0 -1
- package/dist/fix/convert-select-modal-button-to-select-button.d.ts +0 -1
- package/dist/fix/convert-select-modal-button-to-select-button.js +0 -64
- package/dist/fix/convert-select-modal-button-to-select-button.js.map +0 -1
- package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.d.ts +0 -1
- package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.js +0 -38
- package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.js.map +0 -1
- package/dist/fix/convert-to-use-perms-signal.d.ts +0 -1
- package/dist/fix/convert-to-use-perms-signal.js +0 -99
- package/dist/fix/convert-to-use-perms-signal.js.map +0 -1
- package/dist/fix/core/remove-named-import.d.ts +0 -1
- package/dist/fix/core/remove-named-import.js +0 -14
- package/dist/fix/core/remove-named-import.js.map +0 -1
- package/dist/pkg-builders/commons/ScopePathSet.js.map +0 -1
- package/dist/pkg-builders/commons/SdBuildRunnerBase.d.ts +0 -20
- package/dist/pkg-builders/commons/SdBuildRunnerBase.js +0 -30
- package/dist/pkg-builders/commons/SdBuildRunnerBase.js.map +0 -1
- package/src/fix/convert-extends-sd-modal-base-to-interface.ts +0 -324
- package/src/fix/convert-extends-sd-print-template-base-to-interface.ts +0 -201
- package/src/fix/convert-flat-pages-to-flat-menus.ts +0 -83
- package/src/fix/convert-get-menus-to-usable-menus.ts +0 -60
- package/src/fix/convert-modal-show-params.ts +0 -37
- package/src/fix/convert-print-params.ts +0 -51
- package/src/fix/convert-sd-icon-to-fa-icon.ts +0 -95
- package/src/fix/convert-sd-sheet-bindings-safety.ts +0 -73
- package/src/fix/convert-select-modal-button-to-select-button.ts +0 -91
- package/src/fix/convert-setup-cumulate-selected-keys-to-object-param.ts +0 -44
- package/src/fix/convert-to-use-perms-signal.ts +0 -133
- package/src/fix/core/remove-named-import.ts +0 -14
- package/src/pkg-builders/commons/SdBuildRunnerBase.ts +0 -47
- /package/dist/{pkg-builders/commons → ts-compiler}/ScopePathSet.d.ts +0 -0
- /package/dist/{pkg-builders/commons → ts-compiler}/ScopePathSet.js +0 -0
- /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(
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this._opt.
|
|
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.
|
|
69
|
-
...(this._opt.
|
|
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.
|
|
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.
|
|
202
|
+
this._opt.watch?.noEmit ? undefined : this.#buildGlobalStyleAsync(),
|
|
196
203
|
this.#build(prepareResult),
|
|
197
|
-
this._opt.
|
|
204
|
+
this._opt.watch?.emitOnly ? [] : this.#lintAsync(prepareResult),
|
|
198
205
|
]);
|
|
199
206
|
|
|
200
207
|
const affectedFileSet = new Set([
|
|
201
208
|
...prepareResult.affectedFileSet,
|
|
202
|
-
...
|
|
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(`감시 중인 파일: ${
|
|
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:
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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
|
|
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
|
|
319
|
+
this.#scopePathSet,
|
|
316
320
|
this.#cache.dep,
|
|
317
321
|
);
|
|
318
322
|
});
|
|
319
323
|
}
|
|
320
324
|
}
|
|
321
325
|
|
|
322
|
-
const
|
|
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(
|
|
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(
|
|
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
|
-
|
|
352
|
-
|
|
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
|
-
|
|
357
|
-
|
|
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
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
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, "
|
|
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, "
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 {
|
|
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
|
-
|
|
17
|
-
|
|
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/
|
|
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
|
|
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;
|