@simplysm/sd-cli 11.1.44 → 11.1.46
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/build-cluster.js +124 -105
- package/dist/build-cluster.js.map +1 -1
- package/dist/build-tools/SdCliCordova.js.map +1 -1
- package/dist/build-tools/SdCliIndexFileGenerator.js.map +1 -1
- package/dist/build-tools/SdCliNgRoutesFileGenerator.js.map +1 -1
- package/dist/build-tools/SdLinter.js.map +1 -1
- package/dist/build-tools/SdNgBundler.d.ts +1 -1
- package/dist/build-tools/SdNgBundler.js +8 -5
- package/dist/build-tools/SdNgBundler.js.map +1 -1
- package/dist/build-tools/SdNgBundlerContext.js.map +1 -1
- package/dist/build-tools/SdServerBundler.js +1 -1
- package/dist/build-tools/SdServerBundler.js.map +1 -1
- package/dist/build-tools/SdTsCompiler.d.ts +5 -21
- package/dist/build-tools/SdTsCompiler.js +211 -188
- package/dist/build-tools/SdTsCompiler.js.map +1 -1
- package/dist/build-tools2/SdTsCompiler2.d.ts +26 -0
- package/dist/build-tools2/SdTsCompiler2.js +280 -0
- package/dist/build-tools2/SdTsCompiler2.js.map +1 -0
- package/dist/builders/SdCliClientBuilder.js.map +1 -1
- package/dist/builders/SdCliServerBuilder.js.map +1 -1
- package/dist/builders/SdCliTsLibBuilder.js +7 -12
- package/dist/builders/SdCliTsLibBuilder.js.map +1 -1
- package/dist/bundle-plugins/sdNgPlugin.d.ts +3 -3
- package/dist/bundle-plugins/sdNgPlugin.js +23 -213
- package/dist/bundle-plugins/sdNgPlugin.js.map +1 -1
- package/dist/bundle-plugins/sdServerPlugin.d.ts +2 -2
- package/dist/bundle-plugins/sdServerPlugin.js +17 -110
- package/dist/bundle-plugins/sdServerPlugin.js.map +1 -1
- package/dist/commons.d.ts +1 -0
- package/dist/entry/SdCliElectron.js.map +1 -1
- package/dist/entry/SdCliLocalUpdate.js.map +1 -1
- package/dist/entry/SdCliProject.d.ts +1 -0
- package/dist/entry/SdCliProject.js +20 -37
- package/dist/entry/SdCliProject.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/sd-cli.js +7 -1
- package/dist/sd-cli.js.map +1 -1
- package/dist/server-worker.js.map +1 -1
- package/dist/utils/SdCliBuildResultUtil.d.ts +10 -0
- package/dist/utils/SdCliBuildResultUtil.js +17 -1
- package/dist/utils/SdCliBuildResultUtil.js.map +1 -1
- package/package.json +16 -16
- package/src/build-cluster.ts +152 -132
- package/src/build-tools/SdNgBundler.ts +7 -4
- package/src/build-tools/SdServerBundler.ts +2 -2
- package/src/build-tools/SdTsCompiler.ts +64 -94
- package/src/build-tools2/SdTsCompiler2.ts +427 -0
- package/src/builders/SdCliTsLibBuilder.ts +7 -12
- package/src/bundle-plugins/sdNgPlugin.ts +26 -320
- package/src/bundle-plugins/sdServerPlugin.ts +20 -168
- package/src/commons.ts +1 -0
- package/src/entry/SdCliProject.ts +33 -38
- package/src/index.ts +1 -0
- package/src/sd-cli.ts +7 -1
- package/src/server-worker.ts +3 -3
- package/src/utils/SdCliBuildResultUtil.ts +22 -3
|
@@ -1,29 +1,13 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
1
|
import { ISdCliPackageBuildResult } from "../commons";
|
|
2
|
+
import ts from "typescript";
|
|
3
3
|
export declare class SdTsCompiler {
|
|
4
|
-
private
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
private readonly _compilerHost;
|
|
9
|
-
private _program?;
|
|
10
|
-
private _builder?;
|
|
11
|
-
private readonly _isForAngular;
|
|
12
|
-
private _ngProgram?;
|
|
13
|
-
private readonly _styleDepsCache;
|
|
14
|
-
private _markedChanges;
|
|
15
|
-
get program(): ts.Program;
|
|
16
|
-
constructor(_opt: {
|
|
17
|
-
pkgPath: string;
|
|
18
|
-
emit: boolean;
|
|
19
|
-
emitDts: boolean;
|
|
20
|
-
globalStyle: boolean;
|
|
21
|
-
});
|
|
22
|
-
markChanges(changes: string[]): void;
|
|
4
|
+
#private;
|
|
5
|
+
program?: ts.Program;
|
|
6
|
+
constructor(pkgPath: string, dev: boolean);
|
|
7
|
+
markChanges(modifiedFileSet: Set<string>): void;
|
|
23
8
|
buildAsync(): Promise<{
|
|
24
9
|
watchFileSet: Set<string>;
|
|
25
10
|
affectedFileSet: Set<string>;
|
|
26
11
|
results: ISdCliPackageBuildResult[];
|
|
27
12
|
}>;
|
|
28
|
-
private _writeFile;
|
|
29
13
|
}
|
|
@@ -1,227 +1,250 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import ts from "typescript";
|
|
3
1
|
import { SdCliBuildResultUtil } from "../utils/SdCliBuildResultUtil";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import { fileURLToPath, pathToFileURL } from "url";
|
|
8
|
-
import * as sass from "sass";
|
|
2
|
+
import { SdTsCompiler2 } from "../build-tools2/SdTsCompiler2";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { FsUtil, PathUtil } from "@simplysm/sd-core-node";
|
|
9
5
|
export class SdTsCompiler {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
#compiler;
|
|
7
|
+
#pkgPath;
|
|
8
|
+
/*public get program(): ts.Program {
|
|
9
|
+
if (!this._program) {
|
|
10
|
+
throw new Error("TS 프로그램 NULL");
|
|
11
|
+
}
|
|
12
|
+
return this._program;
|
|
13
|
+
}*/
|
|
14
|
+
constructor(pkgPath, dev) {
|
|
15
|
+
this.#pkgPath = pkgPath;
|
|
16
|
+
this.#compiler = new SdTsCompiler2(pkgPath, { declaration: true }, dev, path.resolve(pkgPath, "src/styles.scss"));
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
this.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
//-- vars
|
|
30
|
-
this._isForAngular = Boolean(tsConfig.angularCompilerOptions);
|
|
31
|
-
//-- host
|
|
32
|
-
this._compilerHost = ts.createIncrementalCompilerHost(this._parsedTsConfig.options);
|
|
33
|
-
if (tsConfig.angularCompilerOptions) {
|
|
34
|
-
this._compilerHost["readResource"] = (fileName) => {
|
|
35
|
-
return this._compilerHost.readFile(fileName);
|
|
36
|
-
};
|
|
37
|
-
this._compilerHost["transformResource"] = async (data, context) => {
|
|
38
|
-
if (context.resourceFile != null || context.type !== "style") {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
const scssResult = await sass.compileStringAsync(data, {
|
|
43
|
-
url: new URL(context.containingFile + ".scss"),
|
|
44
|
-
importer: {
|
|
45
|
-
findFileUrl: (url) => pathToFileURL(url)
|
|
46
|
-
},
|
|
47
|
-
logger: sass.Logger.silent
|
|
48
|
-
});
|
|
49
|
-
const styleContent = scssResult.css.toString();
|
|
50
|
-
const deps = scssResult.loadedUrls.slice(1).map((item) => path.resolve(fileURLToPath(item.href)));
|
|
51
|
-
for (const dep of deps) {
|
|
52
|
-
const depCache = this._styleDepsCache.getOrCreate(dep, new Set());
|
|
53
|
-
depCache.add(path.resolve(context.containingFile));
|
|
18
|
+
markChanges(modifiedFileSet) {
|
|
19
|
+
this.#compiler.invalidate(modifiedFileSet);
|
|
20
|
+
}
|
|
21
|
+
async buildAsync() {
|
|
22
|
+
const buildResult = await this.#compiler.buildAsync();
|
|
23
|
+
this.program = buildResult.program;
|
|
24
|
+
for (const affectedFilePath of buildResult.affectedFileSet) {
|
|
25
|
+
const emittedFiles = buildResult.emittedFilesCacheMap.get(affectedFilePath) ?? [];
|
|
26
|
+
for (const emittedFile of emittedFiles) {
|
|
27
|
+
if (emittedFile.outRelPath != null) {
|
|
28
|
+
const distPath = path.resolve(this.#pkgPath, "dist", emittedFile.outRelPath);
|
|
29
|
+
if (PathUtil.isChildPath(distPath, path.resolve(this.#pkgPath, "dist"))) {
|
|
30
|
+
await FsUtil.writeFileAsync(distPath, emittedFile.text);
|
|
54
31
|
}
|
|
55
|
-
return { content: styleContent };
|
|
56
32
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
33
|
+
}
|
|
34
|
+
const globalStylesheetResult = buildResult.stylesheetResultMap.get(affectedFilePath);
|
|
35
|
+
if (globalStylesheetResult) {
|
|
36
|
+
for (const outputFile of globalStylesheetResult.outputFiles) {
|
|
37
|
+
const distPath = path.resolve(this.#pkgPath, "dist", path.relative(this.#pkgPath, outputFile.path));
|
|
38
|
+
if (PathUtil.isChildPath(distPath, path.resolve(this.#pkgPath, "dist"))) {
|
|
39
|
+
await FsUtil.writeFileAsync(distPath, outputFile.text);
|
|
40
|
+
}
|
|
60
41
|
}
|
|
61
|
-
}
|
|
42
|
+
}
|
|
62
43
|
}
|
|
63
|
-
|
|
64
|
-
markChanges(changes) {
|
|
65
|
-
this._markedChanges.push(...changes);
|
|
66
|
-
}
|
|
67
|
-
async buildAsync() {
|
|
68
|
-
const markedChanges = this._markedChanges;
|
|
44
|
+
/*const markedChanges = this._markedChanges;
|
|
69
45
|
this._markedChanges = [];
|
|
46
|
+
|
|
70
47
|
const distPath = path.resolve(this._opt.pkgPath, "dist");
|
|
71
|
-
const srcFilePaths = await FsUtil.globAsync(path.resolve(this._opt.pkgPath, "src
|
|
72
|
-
const srcFilePathSet = new Set(srcFilePaths);
|
|
48
|
+
const srcFilePaths = await FsUtil.globAsync(path.resolve(this._opt.pkgPath, "src/!**!/!*.{ts,tsx}"));
|
|
49
|
+
const srcFilePathSet = new Set<string>(srcFilePaths);
|
|
50
|
+
|
|
73
51
|
if (this._isForAngular) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
this.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
52
|
+
this._ngProgram = new NgtscProgram(
|
|
53
|
+
srcFilePaths,
|
|
54
|
+
this._parsedTsConfig.options,
|
|
55
|
+
this._compilerHost,
|
|
56
|
+
this._ngProgram
|
|
57
|
+
);
|
|
58
|
+
this._program = this._ngProgram.getTsProgram();
|
|
59
|
+
|
|
60
|
+
const baseGetSourceFiles = this._program.getSourceFiles;
|
|
61
|
+
this._program.getSourceFiles = function (...parameters) {
|
|
62
|
+
const files: readonly (ts.SourceFile & { version?: string })[] = baseGetSourceFiles(...parameters);
|
|
63
|
+
|
|
64
|
+
for (const file of files) {
|
|
65
|
+
if (file.version === undefined) {
|
|
66
|
+
file.version = createHash("sha256").update(file.text).digest("hex");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return files;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
this._builder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(
|
|
74
|
+
this._program,
|
|
75
|
+
this._compilerHost,
|
|
76
|
+
this._builder
|
|
77
|
+
);
|
|
87
78
|
}
|
|
88
79
|
else {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
80
|
+
/!*this._program = ts.createProgram(
|
|
81
|
+
srcFilePaths,
|
|
82
|
+
this._parsedTsConfig.options,
|
|
83
|
+
this._compilerHost,
|
|
84
|
+
this._program
|
|
85
|
+
);*!/
|
|
86
|
+
|
|
87
|
+
this._builder = ts.createIncrementalProgram({
|
|
88
|
+
rootNames: srcFilePaths,
|
|
89
|
+
host: this._compilerHost,
|
|
90
|
+
options: this._parsedTsConfig.options,
|
|
91
|
+
createProgram: ts.createEmitAndSemanticDiagnosticsBuilderProgram
|
|
92
|
+
});
|
|
93
|
+
this._program = this._builder.getProgram();
|
|
102
94
|
}
|
|
103
|
-
|
|
104
|
-
const
|
|
95
|
+
|
|
96
|
+
const diagnostics: ts.Diagnostic[] = [];
|
|
97
|
+
const affectedFileSet = new Set<string>();
|
|
98
|
+
|
|
105
99
|
if (this._ngProgram) {
|
|
106
|
-
|
|
100
|
+
diagnostics.push(...this._ngProgram.compiler.getOptionDiagnostics());
|
|
107
101
|
}
|
|
108
|
-
|
|
102
|
+
|
|
103
|
+
diagnostics.push(
|
|
104
|
+
...this._builder.getOptionsDiagnostics(),
|
|
105
|
+
...this._builder.getGlobalDiagnostics()
|
|
106
|
+
);
|
|
107
|
+
|
|
109
108
|
if (this._ngProgram) {
|
|
110
|
-
|
|
109
|
+
await this._ngProgram.compiler.analyzeAsync();
|
|
111
110
|
}
|
|
111
|
+
|
|
112
112
|
this._logger.debug(`[${path.basename(this._opt.pkgPath)}] 영향받는 파일 확인중...`);
|
|
113
113
|
while (true) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
else {
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
if (!semanticResult || !affectedSourceFile)
|
|
136
|
-
break;
|
|
137
|
-
diagnostics.push(...semanticResult.result);
|
|
138
|
-
if ("fileName" in affectedSourceFile) {
|
|
139
|
-
affectedFileSet.add(path.normalize(affectedSourceFile.fileName));
|
|
114
|
+
let affectedSourceFile: ts.SourceFile | undefined;
|
|
115
|
+
|
|
116
|
+
const semanticResult = this._builder.getSemanticDiagnosticsOfNextAffectedFile(undefined, (sourceFile) => {
|
|
117
|
+
//-- ngtypecheck의 org파일 포함 (ngtypecheck 파일는 무시)
|
|
118
|
+
if (this._ngProgram?.compiler.ignoreForDiagnostics.has(sourceFile) && sourceFile.fileName.endsWith(".ngtypecheck.ts")) {
|
|
119
|
+
const orgFileName = sourceFile.fileName.slice(0, -15) + ".ts";
|
|
120
|
+
const orgSourceFile = this._builder!.getSourceFile(orgFileName);
|
|
121
|
+
if (orgSourceFile) {
|
|
122
|
+
affectedSourceFile = orgSourceFile;
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
//-- 소스폴더 파일 포함
|
|
128
|
+
else if (srcFilePathSet.has(path.resolve(sourceFile.fileName))) {
|
|
129
|
+
affectedSourceFile = sourceFile;
|
|
130
|
+
return false;
|
|
140
131
|
}
|
|
132
|
+
|
|
133
|
+
//-- 나머지 무시
|
|
134
|
+
else {
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
if (!semanticResult || !affectedSourceFile) break;
|
|
139
|
+
diagnostics.push(...semanticResult.result);
|
|
140
|
+
|
|
141
|
+
if ("fileName" in affectedSourceFile) {
|
|
142
|
+
affectedFileSet.add(path.normalize(affectedSourceFile.fileName));
|
|
143
|
+
}
|
|
141
144
|
}
|
|
145
|
+
|
|
142
146
|
if (this._isForAngular) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
147
|
+
for (const markedChange of markedChanges) {
|
|
148
|
+
const depsSet = this._styleDepsCache.get(markedChange);
|
|
149
|
+
if (depsSet) {
|
|
150
|
+
affectedFileSet.adds(...depsSet);
|
|
148
151
|
}
|
|
152
|
+
}
|
|
149
153
|
}
|
|
154
|
+
|
|
150
155
|
const globalStyleFilePath = path.resolve(this._opt.pkgPath, "src/styles.scss");
|
|
151
156
|
if (this._opt.globalStyle && FsUtil.exists(globalStyleFilePath) && markedChanges.includes(globalStyleFilePath)) {
|
|
152
|
-
|
|
157
|
+
affectedFileSet.add(globalStyleFilePath);
|
|
153
158
|
}
|
|
159
|
+
|
|
154
160
|
this._logger.debug(`[${path.basename(this._opt.pkgPath)}] 영향받는 파일 ${this._opt.emit ? "EMIT" : "CHECK"}...`);
|
|
161
|
+
|
|
155
162
|
for (const affectedFilePath of affectedFileSet) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
163
|
+
if (this._opt.globalStyle && affectedFilePath === globalStyleFilePath) {
|
|
164
|
+
try {
|
|
165
|
+
const content = await FsUtil.readFileAsync(affectedFilePath);
|
|
166
|
+
const scssResult = await sass.compileStringAsync(content, {
|
|
167
|
+
url: new URL(affectedFilePath),
|
|
168
|
+
importer: {
|
|
169
|
+
findFileUrl: (url) => pathToFileURL(url)
|
|
170
|
+
},
|
|
171
|
+
logger: sass.Logger.silent
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
const deps = scssResult.loadedUrls.slice(1).map((item) => path.resolve(fileURLToPath(item.href)));
|
|
175
|
+
for (const dep of deps) {
|
|
176
|
+
const depCache = this._styleDepsCache.getOrCreate(dep, new Set<string>());
|
|
177
|
+
depCache.add(affectedFilePath);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (this._opt.emit) {
|
|
181
|
+
const outFilePath = path.resolve(this._opt.pkgPath, path.basename(affectedFilePath, path.extname(affectedFilePath)) + ".css");
|
|
182
|
+
|
|
183
|
+
this._writeFile(outFilePath, scssResult.css.toString());
|
|
184
|
+
}
|
|
179
185
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if (this._ngProgram &&
|
|
202
|
-
!affectedSourceFile.isDeclarationFile &&
|
|
203
|
-
!this._ngProgram.compiler.ignoreForEmit.has(affectedSourceFile) &&
|
|
204
|
-
!this._ngProgram.compiler.incrementalCompilation.safeToSkipEmit(affectedSourceFile)) {
|
|
205
|
-
diagnostics.push(...this._ngProgram.compiler.getDiagnosticsForFile(affectedSourceFile, OptimizeFor.WholeProgram));
|
|
186
|
+
catch (err) {
|
|
187
|
+
this._logger.error(err);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
const affectedSourceFile = this._builder.getSourceFile(affectedFilePath);
|
|
192
|
+
if (!affectedSourceFile) continue;
|
|
193
|
+
|
|
194
|
+
const emitResult = this._builder.emit(affectedSourceFile,
|
|
195
|
+
(filePath, data) => {
|
|
196
|
+
let realFilePath = filePath;
|
|
197
|
+
let realData = data;
|
|
198
|
+
if (PathUtil.isChildPath(realFilePath, path.resolve(distPath, path.basename(this._opt.pkgPath), "src"))) {
|
|
199
|
+
realFilePath = path.resolve(distPath, path.relative(path.resolve(distPath, path.basename(this._opt.pkgPath), "src"), realFilePath));
|
|
200
|
+
|
|
201
|
+
if (filePath.endsWith(".js.map")) {
|
|
202
|
+
const sourceMapContents = JSON.parse(realData);
|
|
203
|
+
// remove "../../"
|
|
204
|
+
sourceMapContents.sources[0] = sourceMapContents.sources[0].slice(6);
|
|
205
|
+
realData = JSON.stringify(sourceMapContents);
|
|
206
|
+
}
|
|
206
207
|
}
|
|
208
|
+
|
|
209
|
+
this._ngProgram?.compiler.incrementalCompilation.recordSuccessfulEmit(affectedSourceFile);
|
|
210
|
+
this._writeFile(realFilePath, realData);
|
|
211
|
+
},
|
|
212
|
+
undefined,
|
|
213
|
+
!this._opt.emit,
|
|
214
|
+
{...this._ngProgram?.compiler.prepareEmit().transformers ?? {}}
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
diagnostics.push(...emitResult.diagnostics);
|
|
218
|
+
|
|
219
|
+
diagnostics.push(...this._builder.getSyntacticDiagnostics(affectedSourceFile));
|
|
220
|
+
|
|
221
|
+
if (
|
|
222
|
+
this._ngProgram &&
|
|
223
|
+
!affectedSourceFile.isDeclarationFile &&
|
|
224
|
+
!this._ngProgram.compiler.ignoreForEmit.has(affectedSourceFile) &&
|
|
225
|
+
!this._ngProgram.compiler.incrementalCompilation.safeToSkipEmit(affectedSourceFile)
|
|
226
|
+
) {
|
|
227
|
+
diagnostics.push(
|
|
228
|
+
...this._ngProgram.compiler.getDiagnosticsForFile(affectedSourceFile, OptimizeFor.WholeProgram)
|
|
229
|
+
);
|
|
207
230
|
}
|
|
231
|
+
}
|
|
208
232
|
}
|
|
233
|
+
|
|
209
234
|
this._logger.debug(`[${path.basename(this._opt.pkgPath)}] 영향받는 파일 ${this._opt.emit ? "EMIT" : "CHECK"} 완료`, affectedFileSet);
|
|
210
|
-
|
|
235
|
+
|
|
236
|
+
const buildResults = diagnostics.map((item) => SdCliBuildResultUtil.convertFromTsDiag(item, this._opt.emit ? "build" : "check"));*/
|
|
211
237
|
return {
|
|
212
|
-
watchFileSet:
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
238
|
+
watchFileSet: buildResult.watchFileSet,
|
|
239
|
+
affectedFileSet: buildResult.affectedFileSet,
|
|
240
|
+
results: [
|
|
241
|
+
...buildResult.typescriptDiagnostics.map((item) => SdCliBuildResultUtil.convertFromTsDiag(item, "build")),
|
|
242
|
+
...Array.from(buildResult.stylesheetResultMap.values()).mapMany(item => item.errors)
|
|
243
|
+
.map(err => SdCliBuildResultUtil.convertFromEsbuildResult(err, "build", "error")),
|
|
244
|
+
/*...Array.from(buildResult.stylesheetResultMap.values()).mapMany(item => item.warnings!)
|
|
245
|
+
.map(warn => SdCliBuildResultUtil.convertFromEsbuildResult(warn, "build", "warning"))*/
|
|
246
|
+
]
|
|
218
247
|
};
|
|
219
248
|
}
|
|
220
|
-
_writeFile(filePath, data) {
|
|
221
|
-
if (this._writeFileCache.get(filePath) !== data) {
|
|
222
|
-
this._compilerHost.writeFile(filePath, data, false);
|
|
223
|
-
}
|
|
224
|
-
this._writeFileCache.set(filePath, data);
|
|
225
|
-
}
|
|
226
249
|
}
|
|
227
250
|
//# sourceMappingURL=SdTsCompiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SdTsCompiler.js","sourceRoot":"","sources":["../../src/build-tools/SdTsCompiler.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"SdTsCompiler.js","sourceRoot":"","sources":["../../src/build-tools/SdTsCompiler.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import ts, { CompilerOptions } from "typescript";
|
|
2
|
+
import esbuild from "esbuild";
|
|
3
|
+
export declare class SdTsCompiler2 {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(pkgPath: string, additionalOptions: CompilerOptions, isDevMode: boolean, globalStyleFilePath?: string);
|
|
6
|
+
invalidate(modifiedFileSet: Set<string>): void;
|
|
7
|
+
buildAsync(): Promise<ISdTsCompiler2Result>;
|
|
8
|
+
}
|
|
9
|
+
export interface ISdTsCompiler2Result {
|
|
10
|
+
program: ts.Program;
|
|
11
|
+
typescriptDiagnostics: ts.Diagnostic[];
|
|
12
|
+
stylesheetResultMap: Map<string, IStylesheetResult>;
|
|
13
|
+
emittedFilesCacheMap: Map<string, {
|
|
14
|
+
outRelPath?: string;
|
|
15
|
+
text: string;
|
|
16
|
+
}[]>;
|
|
17
|
+
watchFileSet: Set<string>;
|
|
18
|
+
affectedFileSet: Set<string>;
|
|
19
|
+
}
|
|
20
|
+
interface IStylesheetResult {
|
|
21
|
+
outputFiles: esbuild.OutputFile[];
|
|
22
|
+
metafile?: esbuild.Metafile;
|
|
23
|
+
errors?: esbuild.PartialMessage[];
|
|
24
|
+
warnings?: esbuild.PartialMessage[];
|
|
25
|
+
}
|
|
26
|
+
export {};
|