@simplysm/sd-cli 12.15.39 → 12.15.41
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/entry/SdCliCordova.d.ts +33 -1
- package/dist/entry/SdCliCordova.js +84 -88
- package/dist/entry/SdCliElectron.d.ts +5 -1
- package/dist/entry/SdCliElectron.js +21 -21
- package/dist/entry/SdCliLocalUpdate.d.ts +1 -1
- package/dist/entry/SdCliLocalUpdate.js +3 -3
- package/dist/entry/SdCliProject.d.ts +4 -1
- package/dist/entry/SdCliProject.js +11 -11
- package/dist/pkg-builders/SdProjectBuildRunner.d.ts +6 -1
- package/dist/pkg-builders/SdProjectBuildRunner.js +27 -27
- package/dist/pkg-builders/client/SdClientBuildRunner.d.ts +2 -1
- package/dist/pkg-builders/client/SdClientBuildRunner.js +8 -10
- package/dist/pkg-builders/client/SdNgBundler.d.ts +22 -1
- package/dist/pkg-builders/client/SdNgBundler.js +70 -80
- package/dist/pkg-builders/client/SdNgBundlerContext.d.ts +3 -1
- package/dist/pkg-builders/client/SdNgBundlerContext.js +9 -10
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.d.ts +2 -1
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js +5 -5
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.d.ts +1 -1
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js +2 -2
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.d.ts +1 -1
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js +2 -3
- package/dist/pkg-builders/lib/SdTsLibBuilder.d.ts +2 -1
- package/dist/pkg-builders/lib/SdTsLibBuilder.js +7 -8
- package/dist/pkg-builders/server/SdServerBuildRunner.d.ts +3 -1
- package/dist/pkg-builders/server/SdServerBuildRunner.js +6 -7
- package/dist/pkg-builders/server/SdServerBundler.d.ts +6 -1
- package/dist/pkg-builders/server/SdServerBundler.js +21 -23
- package/dist/ts-compiler/ScopePathSet.d.ts +1 -1
- package/dist/ts-compiler/ScopePathSet.js +3 -4
- package/dist/ts-compiler/SdDepCache.d.ts +45 -1
- package/dist/ts-compiler/SdDepCache.js +71 -69
- package/dist/ts-compiler/SdStyleBundler.d.ts +5 -1
- package/dist/ts-compiler/SdStyleBundler.js +25 -26
- package/dist/ts-compiler/SdTsCompiler.d.ts +20 -1
- package/dist/ts-compiler/SdTsCompiler.js +122 -129
- package/dist/utils/SdCliPerformanceTimer.d.ts +2 -1
- package/dist/utils/SdCliPerformanceTimer.js +9 -9
- package/package.json +8 -8
- package/src/entry/SdCliCordova.ts +89 -89
- package/src/entry/SdCliElectron.ts +21 -21
- package/src/entry/SdCliLocalUpdate.ts +3 -3
- package/src/entry/SdCliProject.ts +11 -11
- package/src/pkg-builders/SdProjectBuildRunner.ts +27 -27
- package/src/pkg-builders/client/SdClientBuildRunner.ts +10 -10
- package/src/pkg-builders/client/SdNgBundler.ts +78 -78
- package/src/pkg-builders/client/SdNgBundlerContext.ts +10 -10
- package/src/pkg-builders/lib/SdCliIndexFileGenerator.ts +5 -5
- package/src/pkg-builders/lib/SdJsLibBuildRunner.ts +2 -2
- package/src/pkg-builders/lib/SdTsLibBuildRunner.ts +3 -3
- package/src/pkg-builders/lib/SdTsLibBuilder.ts +8 -8
- package/src/pkg-builders/server/SdServerBuildRunner.ts +7 -7
- package/src/pkg-builders/server/SdServerBundler.ts +23 -23
- package/src/ts-compiler/ScopePathSet.ts +4 -4
- package/src/ts-compiler/SdDepCache.ts +47 -47
- package/src/ts-compiler/SdStyleBundler.ts +26 -26
- package/src/ts-compiler/SdTsCompiler.ts +130 -130
- package/src/utils/SdCliPerformanceTimer.ts +9 -9
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
export class SdDepCache {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
2
|
+
constructor() {
|
|
3
|
+
/**
|
|
4
|
+
* 각 파일이 export한 심볼 집합 (예: export const A → "A")
|
|
5
|
+
*/
|
|
6
|
+
this._exportCache = new Map();
|
|
7
|
+
/**
|
|
8
|
+
* import한 타겟과 그 심볼 정보
|
|
9
|
+
* - 값이 0이면 전체 import(import * 또는 리소스 import)
|
|
10
|
+
* - 값이 Set이면 선택적 심볼 import (예: import { A } ...)
|
|
11
|
+
*/
|
|
12
|
+
this._importCache = new Map();
|
|
13
|
+
/**
|
|
14
|
+
* re-export한 타겟과 그 심볼 정보
|
|
15
|
+
* - export * from ...
|
|
16
|
+
* - export { A as B } from ...
|
|
17
|
+
* - 값이 0이면 전체 reexport(export * from ...)
|
|
18
|
+
*/
|
|
19
|
+
this._reexportCache = new Map();
|
|
20
|
+
/**
|
|
21
|
+
* 역의존 정보 (revDep)
|
|
22
|
+
* - 특정 파일이 어떤 파일에게 의존(참조)되는지
|
|
23
|
+
* - symbol 기반 추적
|
|
24
|
+
*/
|
|
25
|
+
this._revDepCache = new Map();
|
|
26
|
+
/**
|
|
27
|
+
* 분석이 완료된 파일 경로
|
|
28
|
+
*/
|
|
29
|
+
this._collectedCache = new Set();
|
|
30
|
+
this._exportSymbolCache = new Map();
|
|
31
|
+
}
|
|
30
32
|
/**
|
|
31
33
|
* .d.ts 또는 .js가 입력되었을 때 쌍으로 존재하는 파일 경로를 반환
|
|
32
34
|
* 예: "/a.d.ts" → ["/a.d.ts", "/a.js"]
|
|
33
35
|
*/
|
|
34
|
-
|
|
36
|
+
_getRelatedNPaths(nPath) {
|
|
35
37
|
if (nPath.endsWith(".d.ts")) {
|
|
36
38
|
return [nPath, nPath.replace(/\.d\.ts$/, ".js")];
|
|
37
39
|
}
|
|
@@ -44,20 +46,20 @@ export class SdDepCache {
|
|
|
44
46
|
* 분석이 완료된 파일로 표시
|
|
45
47
|
*/
|
|
46
48
|
addCollected(fileNPath) {
|
|
47
|
-
for (const path of this
|
|
48
|
-
this
|
|
49
|
+
for (const path of this._getRelatedNPaths(fileNPath)) {
|
|
50
|
+
this._collectedCache.add(path);
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
hasCollected(fileNPath) {
|
|
52
|
-
return this
|
|
54
|
+
return this._collectedCache.has(fileNPath);
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* export한 심볼 등록
|
|
56
58
|
* 예: export const A → "A"
|
|
57
59
|
*/
|
|
58
60
|
addExport(fileNPath, exportSymbol) {
|
|
59
|
-
for (const path of this
|
|
60
|
-
const exportSymbolSet = this
|
|
61
|
+
for (const path of this._getRelatedNPaths(fileNPath)) {
|
|
62
|
+
const exportSymbolSet = this._exportCache.getOrCreate(path, new Set());
|
|
61
63
|
exportSymbolSet.add(exportSymbol);
|
|
62
64
|
}
|
|
63
65
|
}
|
|
@@ -67,19 +69,19 @@ export class SdDepCache {
|
|
|
67
69
|
* - import { A } from ... → symbol = "A"
|
|
68
70
|
*/
|
|
69
71
|
addImport(fileNPath, targetNPath, targetSymbol) {
|
|
70
|
-
for (const filePath of this
|
|
71
|
-
const importTargetMap = this
|
|
72
|
-
for (const targetPath of this
|
|
72
|
+
for (const filePath of this._getRelatedNPaths(fileNPath)) {
|
|
73
|
+
const importTargetMap = this._importCache.getOrCreate(filePath, new Map());
|
|
74
|
+
for (const targetPath of this._getRelatedNPaths(targetNPath)) {
|
|
73
75
|
if (typeof targetSymbol === "string") {
|
|
74
76
|
const importTargetSymbolSet = importTargetMap.getOrCreate(targetPath, new Set());
|
|
75
77
|
if (!(importTargetSymbolSet instanceof Set))
|
|
76
78
|
continue;
|
|
77
79
|
importTargetSymbolSet.add(targetSymbol);
|
|
78
|
-
this
|
|
80
|
+
this._addRevDep(targetPath, filePath, targetSymbol);
|
|
79
81
|
}
|
|
80
82
|
else {
|
|
81
83
|
importTargetMap.set(targetPath, targetSymbol);
|
|
82
|
-
this
|
|
84
|
+
this._addRevDep(targetPath, filePath, targetSymbol);
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
}
|
|
@@ -89,12 +91,12 @@ export class SdDepCache {
|
|
|
89
91
|
* ※ export/import에 자동 등록되지 않으므로 외부에서 명시적으로 따로 입력해야 함
|
|
90
92
|
*/
|
|
91
93
|
addReexport(fileNPath, targetNPath, targetSymbolInfo) {
|
|
92
|
-
for (const filePath of this
|
|
93
|
-
const reexportTargetMap = this
|
|
94
|
-
for (const targetPath of this
|
|
94
|
+
for (const filePath of this._getRelatedNPaths(fileNPath)) {
|
|
95
|
+
const reexportTargetMap = this._reexportCache.getOrCreate(filePath, new Map());
|
|
96
|
+
for (const targetPath of this._getRelatedNPaths(targetNPath)) {
|
|
95
97
|
if (targetSymbolInfo === 0) {
|
|
96
98
|
reexportTargetMap.set(targetPath, 0);
|
|
97
|
-
this
|
|
99
|
+
this._addRevDep(targetPath, filePath, 0);
|
|
98
100
|
}
|
|
99
101
|
else {
|
|
100
102
|
const reexportTargetSymbolInfos = reexportTargetMap.getOrCreate(targetPath, []);
|
|
@@ -103,7 +105,7 @@ export class SdDepCache {
|
|
|
103
105
|
if (!reexportTargetSymbolInfos.some((item) => item.importSymbol === targetSymbolInfo.importSymbol &&
|
|
104
106
|
item.exportSymbol === targetSymbolInfo.exportSymbol)) {
|
|
105
107
|
reexportTargetSymbolInfos.push(targetSymbolInfo);
|
|
106
|
-
this
|
|
108
|
+
this._addRevDep(targetPath, filePath, targetSymbolInfo.importSymbol);
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
}
|
|
@@ -112,10 +114,10 @@ export class SdDepCache {
|
|
|
112
114
|
/**
|
|
113
115
|
* 역의존 관계 등록 (revDep)
|
|
114
116
|
*/
|
|
115
|
-
|
|
116
|
-
for (const targetPath of this
|
|
117
|
-
const revDepInfoMap = this
|
|
118
|
-
for (const filePath of this
|
|
117
|
+
_addRevDep(targetNPath, fileNPath, exportSymbol) {
|
|
118
|
+
for (const targetPath of this._getRelatedNPaths(targetNPath)) {
|
|
119
|
+
const revDepInfoMap = this._revDepCache.getOrCreate(targetPath, new Map());
|
|
120
|
+
for (const filePath of this._getRelatedNPaths(fileNPath)) {
|
|
119
121
|
if (typeof exportSymbol === "string") {
|
|
120
122
|
const exportSymbolSet = revDepInfoMap.getOrCreate(filePath, new Set());
|
|
121
123
|
if (!(exportSymbolSet instanceof Set))
|
|
@@ -141,9 +143,9 @@ export class SdDepCache {
|
|
|
141
143
|
queue.push({ fileNPath, exportSymbol });
|
|
142
144
|
}
|
|
143
145
|
};
|
|
144
|
-
for (const relatedNPath of this
|
|
146
|
+
for (const relatedNPath of this._getRelatedNPaths(modifiedNPath)) {
|
|
145
147
|
result.add(relatedNPath);
|
|
146
|
-
const exportSymbols = this
|
|
148
|
+
const exportSymbols = this._getExportSymbols(relatedNPath);
|
|
147
149
|
if (exportSymbols.size === 0) {
|
|
148
150
|
enqueue(relatedNPath, undefined);
|
|
149
151
|
}
|
|
@@ -155,7 +157,7 @@ export class SdDepCache {
|
|
|
155
157
|
}
|
|
156
158
|
while (queue.length > 0) {
|
|
157
159
|
const curr = queue.shift();
|
|
158
|
-
const revDepInfoMap = this
|
|
160
|
+
const revDepInfoMap = this._revDepCache.get(curr.fileNPath);
|
|
159
161
|
if (!revDepInfoMap)
|
|
160
162
|
continue;
|
|
161
163
|
for (const [revDepFileNPath, revDepInfo] of revDepInfoMap) {
|
|
@@ -163,7 +165,7 @@ export class SdDepCache {
|
|
|
163
165
|
const hasImportSymbol = revDepInfo === 0 || revDepInfo.has(curr.exportSymbol);
|
|
164
166
|
if (hasImportSymbol) {
|
|
165
167
|
result.add(revDepFileNPath);
|
|
166
|
-
const exportSymbol = this
|
|
168
|
+
const exportSymbol = this._convertImportSymbolToExportSymbol(revDepFileNPath, curr.fileNPath, curr.exportSymbol);
|
|
167
169
|
enqueue(revDepFileNPath, exportSymbol);
|
|
168
170
|
}
|
|
169
171
|
}
|
|
@@ -182,17 +184,17 @@ export class SdDepCache {
|
|
|
182
184
|
invalidates(fileNPathSet) {
|
|
183
185
|
// const revDepCacheChanged = new Set<TNormPath>();
|
|
184
186
|
for (const fileNPath of fileNPathSet) {
|
|
185
|
-
this
|
|
186
|
-
this
|
|
187
|
-
this
|
|
188
|
-
this
|
|
189
|
-
this
|
|
187
|
+
this._exportCache.delete(fileNPath);
|
|
188
|
+
this._importCache.delete(fileNPath);
|
|
189
|
+
this._reexportCache.delete(fileNPath);
|
|
190
|
+
this._exportSymbolCache.delete(fileNPath);
|
|
191
|
+
this._collectedCache.delete(fileNPath);
|
|
190
192
|
// if (this.#revDepCache.has(fileNPath)) {
|
|
191
193
|
// this.#revDepCache.delete(fileNPath); // 자신이 key인 경우
|
|
192
194
|
// revDepCacheChanged.add(fileNPath);
|
|
193
195
|
// }
|
|
194
196
|
}
|
|
195
|
-
for (const [targetNPath, infoMap] of this
|
|
197
|
+
for (const [targetNPath, infoMap] of this._revDepCache) {
|
|
196
198
|
for (const fileNPath of fileNPathSet) {
|
|
197
199
|
if (infoMap.has(fileNPath)) {
|
|
198
200
|
infoMap.delete(fileNPath);
|
|
@@ -200,15 +202,15 @@ export class SdDepCache {
|
|
|
200
202
|
}
|
|
201
203
|
}
|
|
202
204
|
if (infoMap.size === 0) {
|
|
203
|
-
this
|
|
205
|
+
this._revDepCache.delete(targetNPath);
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
/**
|
|
208
210
|
* reexport된 경우 importSymbol → exportSymbol로 변환
|
|
209
211
|
*/
|
|
210
|
-
|
|
211
|
-
const symbolInfos = this
|
|
212
|
+
_convertImportSymbolToExportSymbol(fileNPath, targetNPath, importSymbol) {
|
|
213
|
+
const symbolInfos = this._reexportCache.get(fileNPath)?.get(targetNPath);
|
|
212
214
|
if (symbolInfos != null && symbolInfos !== 0 && symbolInfos.length > 0) {
|
|
213
215
|
const symbolInfo = symbolInfos.single((item) => item.importSymbol === importSymbol);
|
|
214
216
|
if (symbolInfo)
|
|
@@ -219,20 +221,20 @@ export class SdDepCache {
|
|
|
219
221
|
/**
|
|
220
222
|
* 해당 파일에서 export된 모든 심볼 (직접 + 재export 포함)
|
|
221
223
|
*/
|
|
222
|
-
|
|
223
|
-
if (this
|
|
224
|
-
return this
|
|
224
|
+
_getExportSymbols(fileNPath) {
|
|
225
|
+
if (this._exportSymbolCache.has(fileNPath)) {
|
|
226
|
+
return this._exportSymbolCache.get(fileNPath);
|
|
225
227
|
}
|
|
226
228
|
const result = new Set();
|
|
227
|
-
for (const path of this
|
|
228
|
-
const set = this
|
|
229
|
+
for (const path of this._getRelatedNPaths(fileNPath)) {
|
|
230
|
+
const set = this._exportCache.get(path);
|
|
229
231
|
if (set)
|
|
230
232
|
result.adds(...set);
|
|
231
|
-
const map = this
|
|
233
|
+
const map = this._reexportCache.get(path);
|
|
232
234
|
if (map) {
|
|
233
235
|
for (const [key, val] of map) {
|
|
234
236
|
if (val === 0) {
|
|
235
|
-
result.adds(...this
|
|
237
|
+
result.adds(...this._getExportSymbols(key));
|
|
236
238
|
}
|
|
237
239
|
else {
|
|
238
240
|
result.adds(...val.map((item) => item.exportSymbol));
|
|
@@ -240,7 +242,7 @@ export class SdDepCache {
|
|
|
240
242
|
}
|
|
241
243
|
}
|
|
242
244
|
}
|
|
243
|
-
this
|
|
245
|
+
this._exportSymbolCache.set(fileNPath, result);
|
|
244
246
|
return result;
|
|
245
247
|
}
|
|
246
248
|
}
|
|
@@ -2,8 +2,11 @@ import { TNormPath } from "@simplysm/sd-core-node";
|
|
|
2
2
|
import { TStylesheetBundlingResult } from "../types/build/TStylesheetBundlingResult";
|
|
3
3
|
import { ScopePathSet } from "./ScopePathSet";
|
|
4
4
|
export declare class SdStyleBundler {
|
|
5
|
-
#private;
|
|
6
5
|
private readonly _opt;
|
|
6
|
+
private readonly _ngStyleBundler;
|
|
7
|
+
private readonly _resultCache;
|
|
8
|
+
private readonly _refCache;
|
|
9
|
+
private readonly _revRefCache;
|
|
7
10
|
constructor(_opt: {
|
|
8
11
|
pkgPath: TNormPath;
|
|
9
12
|
scopePathSet: ScopePathSet;
|
|
@@ -14,6 +17,7 @@ export declare class SdStyleBundler {
|
|
|
14
17
|
cached: boolean;
|
|
15
18
|
}>;
|
|
16
19
|
invalidate(modifiedNPathSet: Set<TNormPath>): Set<TNormPath>;
|
|
20
|
+
private _addReference;
|
|
17
21
|
getAllStyleFileSet(): Set<TNormPath>;
|
|
18
22
|
getAffectedFileSet(modifiedNPathSet: Set<TNormPath>): Set<TNormPath>;
|
|
19
23
|
}
|
|
@@ -4,13 +4,12 @@ import { transformSupportedBrowsersToTargets } from "@angular/build/src/tools/es
|
|
|
4
4
|
import browserslist from "browserslist";
|
|
5
5
|
import path from "path";
|
|
6
6
|
export class SdStyleBundler {
|
|
7
|
-
#ngStyleBundler;
|
|
8
|
-
#resultCache = new Map();
|
|
9
|
-
#refCache = new Map();
|
|
10
|
-
#revRefCache = new Map();
|
|
11
7
|
constructor(_opt) {
|
|
12
8
|
this._opt = _opt;
|
|
13
|
-
this
|
|
9
|
+
this._resultCache = new Map();
|
|
10
|
+
this._refCache = new Map();
|
|
11
|
+
this._revRefCache = new Map();
|
|
12
|
+
this._ngStyleBundler = new ComponentStylesheetBundler({
|
|
14
13
|
workspaceRoot: this._opt.pkgPath,
|
|
15
14
|
inlineFonts: !this._opt.dev,
|
|
16
15
|
optimization: !this._opt.dev,
|
|
@@ -37,31 +36,31 @@ export class SdStyleBundler {
|
|
|
37
36
|
}, "scss", this._opt.dev);
|
|
38
37
|
}
|
|
39
38
|
getResultCache() {
|
|
40
|
-
return this
|
|
39
|
+
return this._resultCache;
|
|
41
40
|
}
|
|
42
41
|
async bundleAsync(data, containingFile, resourceFile = null) {
|
|
43
42
|
// containingFile: 포함된 파일 (.ts 혹은 global style.scss)
|
|
44
43
|
// resourceFile: 외부 리소스 파일 (styleUrls로 입력하지 않고 styles에 직접 입력한 경우 null)
|
|
45
44
|
// referencedFiles: import한 외부 scss 파일 혹은 woff파일등 외부 파일
|
|
46
45
|
const fileNPath = PathUtils.norm(resourceFile ?? containingFile);
|
|
47
|
-
if (this
|
|
46
|
+
if (this._resultCache.has(fileNPath)) {
|
|
48
47
|
return {
|
|
49
|
-
...this
|
|
48
|
+
...this._resultCache.get(fileNPath),
|
|
50
49
|
cached: true,
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
52
|
try {
|
|
54
53
|
const result = resourceFile != null
|
|
55
|
-
? await this
|
|
56
|
-
: await this
|
|
54
|
+
? await this._ngStyleBundler.bundleFile(resourceFile)
|
|
55
|
+
: await this._ngStyleBundler.bundleInline(data, containingFile, "scss");
|
|
57
56
|
for (const referencedFile of result.referencedFiles ?? []) {
|
|
58
57
|
if (!this._opt.scopePathSet.inScope(fileNPath) ||
|
|
59
58
|
!this._opt.scopePathSet.inScope(PathUtils.norm(referencedFile)))
|
|
60
59
|
continue;
|
|
61
60
|
// 참조하는 파일과 참조된 파일 사이의 의존성 관계 추가
|
|
62
|
-
this
|
|
61
|
+
this._addReference(fileNPath, PathUtils.norm(referencedFile));
|
|
63
62
|
}
|
|
64
|
-
this
|
|
63
|
+
this._resultCache.set(fileNPath, result);
|
|
65
64
|
return { ...result, cached: false };
|
|
66
65
|
}
|
|
67
66
|
catch (err) {
|
|
@@ -74,45 +73,45 @@ export class SdStyleBundler {
|
|
|
74
73
|
],
|
|
75
74
|
warnings: [],
|
|
76
75
|
};
|
|
77
|
-
this
|
|
76
|
+
this._resultCache.set(fileNPath, result);
|
|
78
77
|
return { ...result, cached: false };
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
invalidate(modifiedNPathSet) {
|
|
82
81
|
const affectedFileSet = this.getAffectedFileSet(modifiedNPathSet);
|
|
83
|
-
this
|
|
82
|
+
this._ngStyleBundler.invalidate(affectedFileSet);
|
|
84
83
|
for (const fileNPath of affectedFileSet) {
|
|
85
|
-
this
|
|
84
|
+
this._resultCache.delete(fileNPath);
|
|
86
85
|
}
|
|
87
86
|
// revRefCache/refCache
|
|
88
87
|
const targetSet = new Set();
|
|
89
88
|
for (const fileNPath of affectedFileSet) {
|
|
90
|
-
targetSet.adds(...(this
|
|
89
|
+
targetSet.adds(...(this._refCache.get(fileNPath) ?? []));
|
|
91
90
|
}
|
|
92
91
|
for (const target of [...targetSet]) {
|
|
93
|
-
const source = this
|
|
92
|
+
const source = this._revRefCache.get(target);
|
|
94
93
|
if (source == null)
|
|
95
94
|
continue;
|
|
96
95
|
for (const affectedFile of affectedFileSet) {
|
|
97
96
|
source.delete(affectedFile);
|
|
98
97
|
}
|
|
99
98
|
if (source.size === 0) {
|
|
100
|
-
this
|
|
99
|
+
this._revRefCache.delete(target);
|
|
101
100
|
}
|
|
102
|
-
this
|
|
101
|
+
this._refCache.delete(target);
|
|
103
102
|
}
|
|
104
103
|
return affectedFileSet;
|
|
105
104
|
}
|
|
106
|
-
|
|
105
|
+
_addReference(fileNPath, referencedFile) {
|
|
107
106
|
if (fileNPath === referencedFile)
|
|
108
107
|
return;
|
|
109
|
-
this
|
|
110
|
-
this
|
|
108
|
+
this._refCache.getOrCreate(fileNPath, new Set()).add(referencedFile);
|
|
109
|
+
this._revRefCache.getOrCreate(referencedFile, new Set()).add(fileNPath);
|
|
111
110
|
}
|
|
112
111
|
getAllStyleFileSet() {
|
|
113
112
|
return new Set([
|
|
114
|
-
...this
|
|
115
|
-
...Array.from(this
|
|
113
|
+
...this._revRefCache.keys(),
|
|
114
|
+
...Array.from(this._revRefCache.values()).mapMany((item) => Array.from(item)),
|
|
116
115
|
]);
|
|
117
116
|
}
|
|
118
117
|
getAffectedFileSet(modifiedNPathSet) {
|
|
@@ -120,12 +119,12 @@ export class SdStyleBundler {
|
|
|
120
119
|
// 수정파일중 Result에 있는것
|
|
121
120
|
const modifiedResultFiles = Array.from(modifiedNPathSet)
|
|
122
121
|
// .filter((item) => item.endsWith(".scss"))
|
|
123
|
-
.filter((item) => this
|
|
122
|
+
.filter((item) => this._resultCache.has(item));
|
|
124
123
|
affectedFileSet.adds(...modifiedResultFiles);
|
|
125
124
|
// 수정파일을 사용하는 파일
|
|
126
125
|
const modifiedScssFiles = Array.from(modifiedNPathSet).filter((item) => item.endsWith(".scss"));
|
|
127
126
|
for (const modifiedScss of modifiedScssFiles) {
|
|
128
|
-
affectedFileSet.adds(...(this
|
|
127
|
+
affectedFileSet.adds(...(this._revRefCache.get(modifiedScss) ?? []));
|
|
129
128
|
}
|
|
130
129
|
return affectedFileSet;
|
|
131
130
|
}
|
|
@@ -2,9 +2,28 @@ import { TNormPath } from "@simplysm/sd-core-node";
|
|
|
2
2
|
import { ISdTsCompilerOptions } from "../types/build/ISdTsCompilerOptions";
|
|
3
3
|
import { ISdTsCompilerResult } from "../types/build/ISdTsCompilerResult";
|
|
4
4
|
export declare class SdTsCompiler {
|
|
5
|
-
#private;
|
|
6
5
|
private readonly _opt;
|
|
7
6
|
private readonly _forBundle;
|
|
7
|
+
private readonly _logger;
|
|
8
|
+
private readonly _isForAngular;
|
|
9
|
+
private readonly _scopePathSet;
|
|
10
|
+
private readonly _styleBundler;
|
|
11
|
+
private _moduleResolutionCache;
|
|
12
|
+
private _ngProgram;
|
|
13
|
+
private _program;
|
|
14
|
+
private readonly _cache;
|
|
15
|
+
private readonly _sourceFileCacheMap;
|
|
16
|
+
private readonly _emittedFilesCacheMap;
|
|
17
|
+
private _perf;
|
|
8
18
|
constructor(_opt: ISdTsCompilerOptions, _forBundle: boolean);
|
|
19
|
+
private _parseTsConfig;
|
|
20
|
+
private _createCompilerHost;
|
|
9
21
|
compileAsync(modifiedFileSet: Set<TNormPath>): Promise<ISdTsCompilerResult>;
|
|
22
|
+
private _prepareAsync;
|
|
23
|
+
private _lintAsync;
|
|
24
|
+
private _buildGlobalStyleAsync;
|
|
25
|
+
private _build;
|
|
26
|
+
private _convertOutputToReal;
|
|
27
|
+
private _removeOutputDevModeLine;
|
|
28
|
+
private _debug;
|
|
10
29
|
}
|