@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
|
@@ -7,10 +7,10 @@ import { ScopePathSet } from "./ScopePathSet";
|
|
|
7
7
|
import path from "path";
|
|
8
8
|
|
|
9
9
|
export class SdStyleBundler {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
private readonly _ngStyleBundler: ComponentStylesheetBundler;
|
|
11
|
+
private readonly _resultCache = new Map<TNormPath, TStylesheetBundlingResult>();
|
|
12
|
+
private readonly _refCache = new Map<TNormPath, Set<TNormPath>>();
|
|
13
|
+
private readonly _revRefCache = new Map<TNormPath, Set<TNormPath>>();
|
|
14
14
|
|
|
15
15
|
constructor(
|
|
16
16
|
private readonly _opt: {
|
|
@@ -19,7 +19,7 @@ export class SdStyleBundler {
|
|
|
19
19
|
dev: boolean;
|
|
20
20
|
},
|
|
21
21
|
) {
|
|
22
|
-
this
|
|
22
|
+
this._ngStyleBundler = new ComponentStylesheetBundler(
|
|
23
23
|
{
|
|
24
24
|
workspaceRoot: this._opt.pkgPath,
|
|
25
25
|
inlineFonts: !this._opt.dev,
|
|
@@ -51,7 +51,7 @@ export class SdStyleBundler {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
getResultCache() {
|
|
54
|
-
return this
|
|
54
|
+
return this._resultCache;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
async bundleAsync(
|
|
@@ -64,9 +64,9 @@ export class SdStyleBundler {
|
|
|
64
64
|
// referencedFiles: import한 외부 scss 파일 혹은 woff파일등 외부 파일
|
|
65
65
|
|
|
66
66
|
const fileNPath = PathUtils.norm(resourceFile ?? containingFile);
|
|
67
|
-
if (this
|
|
67
|
+
if (this._resultCache.has(fileNPath)) {
|
|
68
68
|
return {
|
|
69
|
-
...this
|
|
69
|
+
...this._resultCache.get(fileNPath)!,
|
|
70
70
|
cached: true,
|
|
71
71
|
};
|
|
72
72
|
}
|
|
@@ -74,8 +74,8 @@ export class SdStyleBundler {
|
|
|
74
74
|
try {
|
|
75
75
|
const result =
|
|
76
76
|
resourceFile != null
|
|
77
|
-
? await this
|
|
78
|
-
: await this
|
|
77
|
+
? await this._ngStyleBundler.bundleFile(resourceFile)
|
|
78
|
+
: await this._ngStyleBundler.bundleInline(data, containingFile, "scss");
|
|
79
79
|
|
|
80
80
|
for (const referencedFile of result.referencedFiles ?? []) {
|
|
81
81
|
if (
|
|
@@ -85,10 +85,10 @@ export class SdStyleBundler {
|
|
|
85
85
|
continue;
|
|
86
86
|
|
|
87
87
|
// 참조하는 파일과 참조된 파일 사이의 의존성 관계 추가
|
|
88
|
-
this
|
|
88
|
+
this._addReference(fileNPath, PathUtils.norm(referencedFile));
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
this
|
|
91
|
+
this._resultCache.set(fileNPath, result);
|
|
92
92
|
|
|
93
93
|
return { ...result, cached: false };
|
|
94
94
|
} catch (err) {
|
|
@@ -101,7 +101,7 @@ export class SdStyleBundler {
|
|
|
101
101
|
],
|
|
102
102
|
warnings: [],
|
|
103
103
|
};
|
|
104
|
-
this
|
|
104
|
+
this._resultCache.set(fileNPath, result);
|
|
105
105
|
return { ...result, cached: false };
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -109,44 +109,44 @@ export class SdStyleBundler {
|
|
|
109
109
|
invalidate(modifiedNPathSet: Set<TNormPath>) {
|
|
110
110
|
const affectedFileSet = this.getAffectedFileSet(modifiedNPathSet);
|
|
111
111
|
|
|
112
|
-
this
|
|
112
|
+
this._ngStyleBundler.invalidate(affectedFileSet);
|
|
113
113
|
for (const fileNPath of affectedFileSet) {
|
|
114
|
-
this
|
|
114
|
+
this._resultCache.delete(fileNPath);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// revRefCache/refCache
|
|
118
118
|
const targetSet = new Set<TNormPath>();
|
|
119
119
|
for (const fileNPath of affectedFileSet) {
|
|
120
|
-
targetSet.adds(...(this
|
|
120
|
+
targetSet.adds(...(this._refCache.get(fileNPath) ?? []));
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
for (const target of [...targetSet]) {
|
|
124
|
-
const source = this
|
|
124
|
+
const source = this._revRefCache.get(target);
|
|
125
125
|
if (source == null) continue;
|
|
126
126
|
|
|
127
127
|
for (const affectedFile of affectedFileSet) {
|
|
128
128
|
source.delete(affectedFile);
|
|
129
129
|
}
|
|
130
130
|
if (source.size === 0) {
|
|
131
|
-
this
|
|
131
|
+
this._revRefCache.delete(target);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
this
|
|
134
|
+
this._refCache.delete(target);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
return affectedFileSet;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
private _addReference(fileNPath: TNormPath, referencedFile: TNormPath) {
|
|
141
141
|
if (fileNPath === referencedFile) return;
|
|
142
|
-
this
|
|
143
|
-
this
|
|
142
|
+
this._refCache.getOrCreate(fileNPath, new Set()).add(referencedFile);
|
|
143
|
+
this._revRefCache.getOrCreate(referencedFile, new Set()).add(fileNPath);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
getAllStyleFileSet() {
|
|
147
147
|
return new Set([
|
|
148
|
-
...this
|
|
149
|
-
...Array.from(this
|
|
148
|
+
...this._revRefCache.keys(),
|
|
149
|
+
...Array.from(this._revRefCache.values()).mapMany((item) => Array.from(item)),
|
|
150
150
|
]);
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -155,13 +155,13 @@ export class SdStyleBundler {
|
|
|
155
155
|
// 수정파일중 Result에 있는것
|
|
156
156
|
const modifiedResultFiles = Array.from(modifiedNPathSet)
|
|
157
157
|
// .filter((item) => item.endsWith(".scss"))
|
|
158
|
-
.filter((item) => this
|
|
158
|
+
.filter((item) => this._resultCache.has(item));
|
|
159
159
|
affectedFileSet.adds(...modifiedResultFiles);
|
|
160
160
|
|
|
161
161
|
// 수정파일을 사용하는 파일
|
|
162
162
|
const modifiedScssFiles = Array.from(modifiedNPathSet).filter((item) => item.endsWith(".scss"));
|
|
163
163
|
for (const modifiedScss of modifiedScssFiles) {
|
|
164
|
-
affectedFileSet.adds(...(this
|
|
164
|
+
affectedFileSet.adds(...(this._revRefCache.get(modifiedScss) ?? []));
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
return affectedFileSet;
|