@simplysm/sd-cli 11.1.46 → 11.1.52
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-tools/SdLinter.js +4 -4
- package/dist/build-tools/SdLinter.js.map +1 -1
- package/dist/build-tools/SdNgBundler.d.ts +10 -19
- package/dist/build-tools/SdNgBundler.js +115 -104
- package/dist/build-tools/SdNgBundler.js.map +1 -1
- package/dist/build-tools/SdNgBundlerContext.d.ts +1 -0
- package/dist/build-tools/SdNgBundlerContext.js +11 -3
- package/dist/build-tools/SdNgBundlerContext.js.map +1 -1
- package/dist/build-tools/SdTsCompiler.d.ts +23 -10
- package/dist/build-tools/SdTsCompiler.js +262 -221
- package/dist/build-tools/SdTsCompiler.js.map +1 -1
- package/dist/build-tools/SdTsLibBundler.d.ts +13 -0
- package/dist/build-tools/SdTsLibBundler.js +51 -0
- package/dist/build-tools/SdTsLibBundler.js.map +1 -0
- package/dist/builders/SdCliTsLibBuilder.d.ts +2 -6
- package/dist/builders/SdCliTsLibBuilder.js +26 -21
- package/dist/builders/SdCliTsLibBuilder.js.map +1 -1
- package/dist/bundle-plugins/sdNgPlugin.js +2 -2
- package/dist/bundle-plugins/sdNgPlugin.js.map +1 -1
- package/dist/bundle-plugins/sdServerPlugin.js +2 -2
- package/dist/bundle-plugins/sdServerPlugin.js.map +1 -1
- package/dist/entry/SdCliProject.js +4 -1
- package/dist/entry/SdCliProject.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/sd-cli.d.ts +1 -1
- package/dist/sd-cli.js +1 -1
- package/package.json +5 -5
- package/src/build-tools/SdLinter.ts +4 -4
- package/src/build-tools/SdNgBundler.ts +133 -114
- package/src/build-tools/SdNgBundlerContext.ts +14 -3
- package/src/build-tools/SdTsCompiler.ts +375 -214
- package/src/build-tools/SdTsLibBundler.ts +70 -0
- package/src/builders/SdCliTsLibBuilder.ts +29 -22
- package/src/bundle-plugins/sdNgPlugin.ts +2 -2
- package/src/bundle-plugins/sdServerPlugin.ts +2 -2
- package/src/entry/SdCliProject.ts +4 -1
- package/src/index.ts +1 -1
- package/src/sd-cli.ts +1 -1
- package/dist/build-tools2/SdTsCompiler2.d.ts +0 -26
- package/dist/build-tools2/SdTsCompiler2.js +0 -280
- package/dist/build-tools2/SdTsCompiler2.js.map +0 -1
- package/src/build-tools2/SdTsCompiler2.ts +0 -427
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {SdCliBuildResultUtil} from "../utils/SdCliBuildResultUtil";
|
|
2
|
+
import {ISdCliPackageBuildResult} from "../commons";
|
|
3
|
+
import {SdTsCompiler} from "./SdTsCompiler";
|
|
4
|
+
import ts from "typescript";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import {FsUtil, PathUtil} from "@simplysm/sd-core-node";
|
|
7
|
+
|
|
8
|
+
export class SdTsLibBundler {
|
|
9
|
+
readonly #compiler: SdTsCompiler;
|
|
10
|
+
|
|
11
|
+
readonly #pkgPath: string;
|
|
12
|
+
|
|
13
|
+
public constructor(pkgPath: string, dev: boolean) {
|
|
14
|
+
this.#pkgPath = pkgPath;
|
|
15
|
+
this.#compiler = new SdTsCompiler(
|
|
16
|
+
pkgPath,
|
|
17
|
+
{declaration: true},
|
|
18
|
+
dev,
|
|
19
|
+
path.resolve(pkgPath, "src/styles.scss")
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public markChanges(modifiedFileSet: Set<string>): void {
|
|
24
|
+
this.#compiler.invalidate(modifiedFileSet);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public async buildAsync(): Promise<{
|
|
28
|
+
program: ts.Program;
|
|
29
|
+
watchFileSet: Set<string>;
|
|
30
|
+
affectedFileSet: Set<string>;
|
|
31
|
+
results: ISdCliPackageBuildResult[];
|
|
32
|
+
}> {
|
|
33
|
+
const buildResult = await this.#compiler.buildAsync();
|
|
34
|
+
|
|
35
|
+
for (const affectedFilePath of buildResult.affectedFileSet) {
|
|
36
|
+
const emittedFiles = buildResult.emittedFilesCacheMap.get(affectedFilePath) ?? [];
|
|
37
|
+
for (const emittedFile of emittedFiles) {
|
|
38
|
+
if (emittedFile.outRelPath != null) {
|
|
39
|
+
const distPath = path.resolve(this.#pkgPath, "dist", emittedFile.outRelPath);
|
|
40
|
+
if (PathUtil.isChildPath(distPath, path.resolve(this.#pkgPath, "dist"))) {
|
|
41
|
+
await FsUtil.writeFileAsync(distPath, emittedFile.text);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const globalStylesheetResult = buildResult.stylesheetResultMap.get(affectedFilePath);
|
|
47
|
+
if (globalStylesheetResult) {
|
|
48
|
+
for (const outputFile of globalStylesheetResult.outputFiles) {
|
|
49
|
+
const distPath = path.resolve(this.#pkgPath, "dist", path.relative(this.#pkgPath, outputFile.path));
|
|
50
|
+
if (PathUtil.isChildPath(distPath, path.resolve(this.#pkgPath, "dist"))) {
|
|
51
|
+
await FsUtil.writeFileAsync(distPath, outputFile.text);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
program: buildResult.program,
|
|
59
|
+
watchFileSet: buildResult.watchFileSet,
|
|
60
|
+
affectedFileSet: buildResult.affectedFileSet,
|
|
61
|
+
results: [
|
|
62
|
+
...buildResult.typescriptDiagnostics.map((item) => SdCliBuildResultUtil.convertFromTsDiag(item, "build")),
|
|
63
|
+
...Array.from(buildResult.stylesheetResultMap.values()).mapMany(item => item.errors ?? [])
|
|
64
|
+
.map(err => SdCliBuildResultUtil.convertFromEsbuildResult(err, "build", "error")),
|
|
65
|
+
/*...Array.from(buildResult.stylesheetResultMap.values()).mapMany(item => item.warnings!)
|
|
66
|
+
.map(warn => SdCliBuildResultUtil.convertFromEsbuildResult(warn, "build", "warning"))*/
|
|
67
|
+
]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -2,21 +2,27 @@ import {FsUtil, Logger, PathUtil, SdFsWatcher} from "@simplysm/sd-core-node";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import {ISdCliBuilderResult, ISdCliConfig, ISdCliLibPackageConfig, ISdCliPackageBuildResult} from "../commons";
|
|
4
4
|
import {EventEmitter} from "events";
|
|
5
|
-
import {
|
|
5
|
+
import {SdTsLibBundler} from "../build-tools/SdTsLibBundler";
|
|
6
6
|
import {SdLinter} from "../build-tools/SdLinter";
|
|
7
7
|
import {FunctionQueue} from "@simplysm/sd-core-common";
|
|
8
8
|
import {SdCliIndexFileGenerator} from "../build-tools/SdCliIndexFileGenerator";
|
|
9
9
|
|
|
10
10
|
export class SdCliTsLibBuilder extends EventEmitter {
|
|
11
|
-
|
|
11
|
+
readonly #logger = Logger.get(["simplysm", "sd-cli", "SdCliTsLibBuilder"]);
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
readonly #projConf: ISdCliConfig;
|
|
14
|
+
readonly #pkgPath: string;
|
|
15
|
+
readonly #pkgConf: ISdCliLibPackageConfig;
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
#bundler?: SdTsLibBundler;
|
|
18
|
+
|
|
19
|
+
public constructor(projConf: ISdCliConfig,
|
|
20
|
+
pkgPath: string) {
|
|
18
21
|
super();
|
|
19
|
-
this
|
|
22
|
+
this.#projConf = projConf;
|
|
23
|
+
this.#pkgPath = pkgPath;
|
|
24
|
+
|
|
25
|
+
this.#pkgConf = projConf.packages[path.basename(pkgPath)] as ISdCliLibPackageConfig;
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
public override on(event: "change", listener: () => void): this;
|
|
@@ -28,11 +34,11 @@ export class SdCliTsLibBuilder extends EventEmitter {
|
|
|
28
34
|
|
|
29
35
|
public async buildAsync(): Promise<ISdCliBuilderResult> {
|
|
30
36
|
this._debug("dist 초기화...");
|
|
31
|
-
await FsUtil.removeAsync(path.resolve(this
|
|
37
|
+
await FsUtil.removeAsync(path.resolve(this.#pkgPath, "dist"));
|
|
32
38
|
|
|
33
|
-
if (!this.
|
|
39
|
+
if (!this.#pkgConf.noGenIndex) {
|
|
34
40
|
this._debug("GEN index.ts...");
|
|
35
|
-
await SdCliIndexFileGenerator.runAsync(this
|
|
41
|
+
await SdCliIndexFileGenerator.runAsync(this.#pkgPath, this.#pkgConf.polyfills);
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
const result = await this._runAsync(false);
|
|
@@ -46,11 +52,11 @@ export class SdCliTsLibBuilder extends EventEmitter {
|
|
|
46
52
|
this.emit("change");
|
|
47
53
|
|
|
48
54
|
this._debug("dist 초기화...");
|
|
49
|
-
await FsUtil.removeAsync(path.resolve(this
|
|
55
|
+
await FsUtil.removeAsync(path.resolve(this.#pkgPath, "dist"));
|
|
50
56
|
|
|
51
|
-
if (!this.
|
|
57
|
+
if (!this.#pkgConf.noGenIndex) {
|
|
52
58
|
this._debug("WATCH GEN index.ts...");
|
|
53
|
-
await SdCliIndexFileGenerator.watchAsync(this
|
|
59
|
+
await SdCliIndexFileGenerator.watchAsync(this.#pkgPath, this.#pkgConf.polyfills);
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
const result = await this._runAsync(true);
|
|
@@ -64,7 +70,7 @@ export class SdCliTsLibBuilder extends EventEmitter {
|
|
|
64
70
|
const watcher = SdFsWatcher
|
|
65
71
|
.watch(Array.from(result.watchFileSet))
|
|
66
72
|
.onChange({delay: 100,}, (changeInfos) => {
|
|
67
|
-
this
|
|
73
|
+
this.#bundler!.markChanges(new Set(changeInfos.map((item) => item.path)));
|
|
68
74
|
|
|
69
75
|
fnQ.runLast(async () => {
|
|
70
76
|
this.emit("change");
|
|
@@ -85,18 +91,19 @@ export class SdCliTsLibBuilder extends EventEmitter {
|
|
|
85
91
|
affectedFileSet: Set<string>;
|
|
86
92
|
buildResults: ISdCliPackageBuildResult[];
|
|
87
93
|
}> {
|
|
88
|
-
this._debug(`BUILD
|
|
89
|
-
this
|
|
90
|
-
const buildResult = await this.
|
|
94
|
+
this._debug(`BUILD...`);
|
|
95
|
+
this.#bundler = this.#bundler ?? new SdTsLibBundler(this.#pkgPath, dev);
|
|
96
|
+
const buildResult = await this.#bundler.buildAsync();
|
|
91
97
|
|
|
92
98
|
this._debug("LINT...");
|
|
93
|
-
const
|
|
99
|
+
const lintFilePaths = Array.from(buildResult.affectedFileSet).filter(item => PathUtil.isChildPath(item, this.#pkgPath));
|
|
100
|
+
const lintResults = await SdLinter.lintAsync(lintFilePaths, buildResult.program);
|
|
94
101
|
|
|
95
102
|
this._debug(`빌드 완료`);
|
|
96
|
-
const localUpdatePaths = Object.keys(this.
|
|
97
|
-
.mapMany((key) => FsUtil.glob(path.resolve(this
|
|
103
|
+
const localUpdatePaths = Object.keys(this.#projConf.localUpdates ?? {})
|
|
104
|
+
.mapMany((key) => FsUtil.glob(path.resolve(this.#pkgPath, "../../node_modules", key)));
|
|
98
105
|
const watchFileSet = new Set(Array.from(buildResult.watchFileSet).filter(item =>
|
|
99
|
-
PathUtil.isChildPath(item, path.resolve(this
|
|
106
|
+
PathUtil.isChildPath(item, path.resolve(this.#pkgPath, "../")) ||
|
|
100
107
|
localUpdatePaths.some((lu) => PathUtil.isChildPath(item, lu))
|
|
101
108
|
));
|
|
102
109
|
|
|
@@ -108,6 +115,6 @@ export class SdCliTsLibBuilder extends EventEmitter {
|
|
|
108
115
|
}
|
|
109
116
|
|
|
110
117
|
private _debug(msg: string): void {
|
|
111
|
-
this.
|
|
118
|
+
this.#logger.debug(`[${path.basename(this.#pkgPath)}] ${msg}`);
|
|
112
119
|
}
|
|
113
120
|
}
|
|
@@ -3,7 +3,7 @@ import ts from "typescript";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import {JavaScriptTransformer} from "@angular-devkit/build-angular/src/tools/esbuild/javascript-transformer";
|
|
5
5
|
import os from "os";
|
|
6
|
-
import {ISdTsCompiler2Result,
|
|
6
|
+
import {ISdTsCompiler2Result, SdTsCompiler} from "../build-tools/SdTsCompiler";
|
|
7
7
|
import {convertTypeScriptDiagnostic} from "@angular-devkit/build-angular/src/tools/esbuild/angular/diagnostics";
|
|
8
8
|
|
|
9
9
|
export function sdNgPlugin(conf: {
|
|
@@ -15,7 +15,7 @@ export function sdNgPlugin(conf: {
|
|
|
15
15
|
return {
|
|
16
16
|
name: "sd-ng-compiler",
|
|
17
17
|
setup: (build: esbuild.PluginBuild) => {
|
|
18
|
-
const compiler = new
|
|
18
|
+
const compiler = new SdTsCompiler(conf.pkgPath, {declaration: false}, conf.dev);
|
|
19
19
|
|
|
20
20
|
let buildResult: ISdTsCompiler2Result;
|
|
21
21
|
const outputContentsCacheMap = new Map<string, Uint8Array>();
|
|
@@ -2,7 +2,7 @@ import esbuild from "esbuild";
|
|
|
2
2
|
import ts from "typescript";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import {convertTypeScriptDiagnostic} from "@angular-devkit/build-angular/src/tools/esbuild/angular/diagnostics";
|
|
5
|
-
import {ISdTsCompiler2Result,
|
|
5
|
+
import {ISdTsCompiler2Result, SdTsCompiler} from "../build-tools/SdTsCompiler";
|
|
6
6
|
|
|
7
7
|
export function sdServerPlugin(conf: {
|
|
8
8
|
pkgPath: string;
|
|
@@ -13,7 +13,7 @@ export function sdServerPlugin(conf: {
|
|
|
13
13
|
return {
|
|
14
14
|
name: "sd-server-compiler",
|
|
15
15
|
setup: (build: esbuild.PluginBuild) => {
|
|
16
|
-
const compiler = new
|
|
16
|
+
const compiler = new SdTsCompiler(conf.pkgPath, {declaration: false}, conf.dev);
|
|
17
17
|
|
|
18
18
|
let buildResult: ISdTsCompiler2Result;
|
|
19
19
|
|
|
@@ -87,7 +87,9 @@ export class SdCliProject {
|
|
|
87
87
|
else if (message.type === "complete") {
|
|
88
88
|
resultCache.delete("none");
|
|
89
89
|
for (const affectedFilePath of message.result!.affectedFilePaths) {
|
|
90
|
-
|
|
90
|
+
if (PathUtil.isChildPath(affectedFilePath, message.req.pkgPath)) {
|
|
91
|
+
resultCache.delete(affectedFilePath);
|
|
92
|
+
}
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
for (const buildResult of message.result!.buildResults) {
|
|
@@ -369,6 +371,7 @@ export class SdCliProject {
|
|
|
369
371
|
if (projConf.postPublish && projConf.postPublish.length > 0) {
|
|
370
372
|
logger.debug("배포후 작업...");
|
|
371
373
|
for (const postPublishItem of projConf.postPublish) {
|
|
374
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
372
375
|
if (postPublishItem.type === "script") {
|
|
373
376
|
const script = postPublishItem.script.replace(/%([^%]*)%/g, (item) => {
|
|
374
377
|
const envName = item.replace(/%/g, "");
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export * from "./build-tools/SdNgBundler";
|
|
|
6
6
|
export * from "./build-tools/SdNgBundlerContext";
|
|
7
7
|
export * from "./build-tools/SdServerBundler";
|
|
8
8
|
export * from "./build-tools/SdTsCompiler";
|
|
9
|
-
export * from "./build-
|
|
9
|
+
export * from "./build-tools/SdTsLibBundler";
|
|
10
10
|
export * from "./builders/SdCliClientBuilder";
|
|
11
11
|
export * from "./builders/SdCliJsLibLinter";
|
|
12
12
|
export * from "./builders/SdCliServerBuilder";
|
package/src/sd-cli.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node --es-module-specifier-resolution=node --no-warnings --experimental-import-meta-resolve
|
|
1
|
+
#!/usr/bin/env node --es-module-specifier-resolution=node --no-warnings --experimental-import-meta-resolve
|
|
2
2
|
|
|
3
3
|
import yargs from "yargs";
|
|
4
4
|
import {hideBin} from "yargs/helpers";
|
|
@@ -1,26 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { FsUtil, PathUtil } from "@simplysm/sd-core-node";
|
|
4
|
-
import { transformSupportedBrowsersToTargets } from "@angular-devkit/build-angular/src/tools/esbuild/utils";
|
|
5
|
-
import browserslist from "browserslist";
|
|
6
|
-
import { ComponentStylesheetBundler } from "@angular-devkit/build-angular/src/tools/esbuild/angular/component-stylesheets";
|
|
7
|
-
import { StringUtil } from "@simplysm/sd-core-common";
|
|
8
|
-
import { NgtscProgram, OptimizeFor } from "@angular/compiler-cli";
|
|
9
|
-
import { createHash } from "crypto";
|
|
10
|
-
export class SdTsCompiler2 {
|
|
11
|
-
#parsedTsconfig;
|
|
12
|
-
#isForAngular;
|
|
13
|
-
#resourceDependencyCacheMap = new Map();
|
|
14
|
-
#sourceFileCacheMap = new Map();
|
|
15
|
-
#emittedFilesCacheMap = new Map();
|
|
16
|
-
#stylesheetBundler;
|
|
17
|
-
#compilerHost;
|
|
18
|
-
#ngProgram;
|
|
19
|
-
#program;
|
|
20
|
-
#builder;
|
|
21
|
-
#modifiedFileSet = new Set();
|
|
22
|
-
#watchFileSet = new Set();
|
|
23
|
-
#stylesheetResultMap = new Map();
|
|
24
|
-
#affectedFileSet = new Set();
|
|
25
|
-
#pkgPath;
|
|
26
|
-
#distPath;
|
|
27
|
-
#globalStyleFilePath;
|
|
28
|
-
constructor(pkgPath, additionalOptions, isDevMode, globalStyleFilePath) {
|
|
29
|
-
this.#pkgPath = pkgPath;
|
|
30
|
-
this.#globalStyleFilePath = globalStyleFilePath != null ? path.normalize(globalStyleFilePath) : undefined;
|
|
31
|
-
//-- isForAngular / parsedTsConfig
|
|
32
|
-
const tsconfigPath = path.resolve(pkgPath, "tsconfig.json");
|
|
33
|
-
const tsconfig = FsUtil.readJson(tsconfigPath);
|
|
34
|
-
this.#isForAngular = Boolean(tsconfig.angularCompilerOptions);
|
|
35
|
-
this.#parsedTsconfig = ts.parseJsonConfigFileContent(tsconfig, ts.sys, pkgPath, {
|
|
36
|
-
...tsconfig.angularCompilerOptions,
|
|
37
|
-
...additionalOptions
|
|
38
|
-
});
|
|
39
|
-
this.#distPath = this.#parsedTsconfig.options.outDir ?? path.resolve(pkgPath, "dist");
|
|
40
|
-
//-- compilerHost
|
|
41
|
-
this.#compilerHost = ts.createIncrementalCompilerHost(this.#parsedTsconfig.options);
|
|
42
|
-
const baseGetSourceFile = this.#compilerHost.getSourceFile;
|
|
43
|
-
this.#compilerHost.getSourceFile = (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile, ...args) => {
|
|
44
|
-
if (!shouldCreateNewSourceFile && this.#sourceFileCacheMap.has(path.normalize(fileName))) {
|
|
45
|
-
return this.#sourceFileCacheMap.get(path.normalize(fileName));
|
|
46
|
-
}
|
|
47
|
-
const sf = baseGetSourceFile.call(this.#compilerHost, fileName, languageVersionOrOptions, onError, true, ...args);
|
|
48
|
-
if (sf) {
|
|
49
|
-
this.#sourceFileCacheMap.set(path.normalize(fileName), sf);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
this.#sourceFileCacheMap.delete(path.normalize(fileName));
|
|
53
|
-
}
|
|
54
|
-
return sf;
|
|
55
|
-
};
|
|
56
|
-
if (this.#isForAngular) {
|
|
57
|
-
//-- stylesheetBundler
|
|
58
|
-
const browserTarget = transformSupportedBrowsersToTargets(browserslist("defaults and fully supports es6-module"));
|
|
59
|
-
this.#stylesheetBundler = new ComponentStylesheetBundler({
|
|
60
|
-
workspaceRoot: pkgPath,
|
|
61
|
-
optimization: !isDevMode,
|
|
62
|
-
inlineFonts: true,
|
|
63
|
-
preserveSymlinks: false,
|
|
64
|
-
sourcemap: 'inline', //conf.dev ? 'inline' : false,
|
|
65
|
-
outputNames: { bundles: '[name]', media: 'media/[name]' },
|
|
66
|
-
includePaths: [],
|
|
67
|
-
externalDependencies: [],
|
|
68
|
-
target: browserTarget,
|
|
69
|
-
tailwindConfiguration: undefined,
|
|
70
|
-
cacheOptions: {
|
|
71
|
-
enabled: true,
|
|
72
|
-
path: ".cache/angular",
|
|
73
|
-
basePath: ".cache"
|
|
74
|
-
}
|
|
75
|
-
}, isDevMode);
|
|
76
|
-
//-- compilerHost
|
|
77
|
-
this.#compilerHost.readResource = (fileName) => {
|
|
78
|
-
return this.#compilerHost.readFile(fileName) ?? "";
|
|
79
|
-
};
|
|
80
|
-
this.#compilerHost.transformResource = async (data, context) => {
|
|
81
|
-
if (context.type !== "style") {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
const contents = await this.#bundleStylesheetAsync(data, context.containingFile, context.resourceFile);
|
|
85
|
-
return StringUtil.isNullOrEmpty(contents) ? null : { content: contents };
|
|
86
|
-
};
|
|
87
|
-
this.#compilerHost.getModifiedResourceFiles = () => {
|
|
88
|
-
return this.#modifiedFileSet;
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
async #bundleStylesheetAsync(data, containingFile, resourceFile = null) {
|
|
93
|
-
const stylesheetResult = resourceFile != null
|
|
94
|
-
? await this.#stylesheetBundler.bundleFile(resourceFile)
|
|
95
|
-
: await this.#stylesheetBundler.bundleInline(data, containingFile, "scss");
|
|
96
|
-
this.#watchFileSet.add(path.normalize(containingFile));
|
|
97
|
-
if (resourceFile != null) {
|
|
98
|
-
this.#watchFileSet.add(path.normalize(resourceFile));
|
|
99
|
-
}
|
|
100
|
-
if (stylesheetResult.referencedFiles) {
|
|
101
|
-
for (const referencedFile of stylesheetResult.referencedFiles) {
|
|
102
|
-
const referencingMapValSet = this.#resourceDependencyCacheMap.getOrCreate(path.normalize(referencedFile), new Set());
|
|
103
|
-
referencingMapValSet.add(path.normalize(containingFile));
|
|
104
|
-
if (resourceFile != null) {
|
|
105
|
-
referencingMapValSet.add(path.normalize(resourceFile));
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
this.#watchFileSet.adds(...Array.from(stylesheetResult.referencedFiles.values()).map(item => path.normalize(item)));
|
|
109
|
-
}
|
|
110
|
-
this.#stylesheetResultMap.set(path.normalize(resourceFile ?? containingFile), {
|
|
111
|
-
outputFiles: stylesheetResult.outputFiles ?? [],
|
|
112
|
-
metafile: stylesheetResult.metafile,
|
|
113
|
-
errors: stylesheetResult.errors,
|
|
114
|
-
warnings: stylesheetResult.warnings
|
|
115
|
-
});
|
|
116
|
-
return stylesheetResult.contents;
|
|
117
|
-
}
|
|
118
|
-
invalidate(modifiedFileSet) {
|
|
119
|
-
this.#stylesheetBundler?.invalidate(modifiedFileSet);
|
|
120
|
-
for (const modifiedFile of modifiedFileSet) {
|
|
121
|
-
this.#stylesheetResultMap.delete(path.normalize(modifiedFile));
|
|
122
|
-
this.#sourceFileCacheMap.delete(path.normalize(modifiedFile));
|
|
123
|
-
this.#emittedFilesCacheMap.delete(path.normalize(modifiedFile));
|
|
124
|
-
if (this.#resourceDependencyCacheMap.has(path.normalize(modifiedFile))) {
|
|
125
|
-
for (const referencingFile of this.#resourceDependencyCacheMap.get(path.normalize(modifiedFile))) {
|
|
126
|
-
this.#stylesheetResultMap.delete(path.normalize(referencingFile));
|
|
127
|
-
this.#sourceFileCacheMap.delete(path.normalize(referencingFile));
|
|
128
|
-
this.#emittedFilesCacheMap.delete(path.normalize(referencingFile));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
this.#modifiedFileSet.adds(...modifiedFileSet);
|
|
133
|
-
}
|
|
134
|
-
async buildAsync() {
|
|
135
|
-
this.#resourceDependencyCacheMap.clear();
|
|
136
|
-
this.#watchFileSet.clear();
|
|
137
|
-
this.#stylesheetResultMap.clear();
|
|
138
|
-
this.#affectedFileSet.clear();
|
|
139
|
-
if (this.#isForAngular) {
|
|
140
|
-
this.#ngProgram = new NgtscProgram(this.#parsedTsconfig.fileNames, this.#parsedTsconfig.options, this.#compilerHost, this.#ngProgram);
|
|
141
|
-
this.#program = this.#ngProgram.getTsProgram();
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
// noinspection UnnecessaryLocalVariableJS
|
|
145
|
-
this.#program = ts.createProgram(this.#parsedTsconfig.fileNames, this.#parsedTsconfig.options, this.#compilerHost, this.#program);
|
|
146
|
-
}
|
|
147
|
-
const baseGetSourceFiles = this.#program.getSourceFiles;
|
|
148
|
-
this.#program.getSourceFiles = function (...parameters) {
|
|
149
|
-
const files = baseGetSourceFiles(...parameters);
|
|
150
|
-
for (const file of files) {
|
|
151
|
-
if (file.version === undefined) {
|
|
152
|
-
file.version = createHash("sha256").update(file.text).digest("hex");
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return files;
|
|
156
|
-
};
|
|
157
|
-
this.#builder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(this.#program, this.#compilerHost, this.#builder);
|
|
158
|
-
if (this.#ngProgram) {
|
|
159
|
-
await this.#ngProgram.compiler.analyzeAsync();
|
|
160
|
-
}
|
|
161
|
-
//-- affectedFilePathSet
|
|
162
|
-
while (true) {
|
|
163
|
-
const result = this.#builder.getSemanticDiagnosticsOfNextAffectedFile(undefined, (sourceFile) => {
|
|
164
|
-
if (this.#ngProgram
|
|
165
|
-
&& this.#ngProgram.compiler.ignoreForDiagnostics.has(sourceFile)
|
|
166
|
-
&& sourceFile.fileName.endsWith('.ngtypecheck.ts')) {
|
|
167
|
-
const originalFilename = sourceFile.fileName.slice(0, -15) + '.ts';
|
|
168
|
-
const originalSourceFile = this.#sourceFileCacheMap.get(originalFilename);
|
|
169
|
-
if (originalSourceFile) {
|
|
170
|
-
this.#affectedFileSet.add(path.normalize(originalSourceFile.fileName));
|
|
171
|
-
}
|
|
172
|
-
return true;
|
|
173
|
-
}
|
|
174
|
-
return false;
|
|
175
|
-
});
|
|
176
|
-
if (!result) {
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
this.#affectedFileSet.add(path.normalize(result.affected.fileName));
|
|
180
|
-
}
|
|
181
|
-
// Deps -> refMap
|
|
182
|
-
this.#builder.getSourceFiles().filter(sf => !this.#ngProgram || !this.#ngProgram.compiler.ignoreForEmit.has(sf))
|
|
183
|
-
.forEach(sf => {
|
|
184
|
-
this.#watchFileSet.add(path.normalize(sf.fileName));
|
|
185
|
-
if (this.#ngProgram) {
|
|
186
|
-
const deps = this.#ngProgram.compiler.getResourceDependencies(sf);
|
|
187
|
-
for (const dep of deps) {
|
|
188
|
-
const ref = this.#resourceDependencyCacheMap.getOrCreate(path.normalize(dep), new Set());
|
|
189
|
-
ref.add(path.normalize(sf.fileName));
|
|
190
|
-
this.#watchFileSet.add(path.normalize(dep));
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
//-- diagnostics
|
|
195
|
-
const diagnostics = [];
|
|
196
|
-
diagnostics.push(...this.#builder.getConfigFileParsingDiagnostics(), ...this.#builder.getOptionsDiagnostics(), ...this.#builder.getGlobalDiagnostics());
|
|
197
|
-
if (this.#ngProgram) {
|
|
198
|
-
diagnostics.push(...this.#ngProgram.compiler.getOptionDiagnostics());
|
|
199
|
-
}
|
|
200
|
-
for (const affectedFile of this.#affectedFileSet) {
|
|
201
|
-
const affectedSourceFile = this.#sourceFileCacheMap.get(affectedFile);
|
|
202
|
-
if (!affectedSourceFile || (this.#ngProgram && this.#ngProgram.compiler.ignoreForDiagnostics.has(affectedSourceFile))) {
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
205
|
-
diagnostics.push(...this.#builder.getSyntacticDiagnostics(affectedSourceFile), ...this.#builder.getSemanticDiagnostics(affectedSourceFile));
|
|
206
|
-
if (this.#ngProgram) {
|
|
207
|
-
if (affectedSourceFile.isDeclarationFile) {
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
210
|
-
diagnostics.push(...this.#ngProgram.compiler.getDiagnosticsForFile(affectedSourceFile, OptimizeFor.WholeProgram));
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
//-- prepare emit cache
|
|
214
|
-
while (true) {
|
|
215
|
-
const affectedFileResult = this.#builder.emitNextAffectedFile((fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
|
|
216
|
-
if (!sourceFiles || sourceFiles.length === 0) {
|
|
217
|
-
this.#compilerHost.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
const sourceFile = ts.getOriginalNode(sourceFiles[0], ts.isSourceFile);
|
|
221
|
-
if (this.#ngProgram) {
|
|
222
|
-
if (this.#ngProgram.compiler.ignoreForEmit.has(sourceFile)) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
this.#ngProgram.compiler.incrementalCompilation.recordSuccessfulEmit(sourceFile);
|
|
226
|
-
}
|
|
227
|
-
const emittedFiles = this.#emittedFilesCacheMap.getOrCreate(path.normalize(sourceFile.fileName), []);
|
|
228
|
-
if (PathUtil.isChildPath(sourceFile.fileName, this.#pkgPath)) {
|
|
229
|
-
let realFilePath = fileName;
|
|
230
|
-
let realText = text;
|
|
231
|
-
if (PathUtil.isChildPath(realFilePath, path.resolve(this.#distPath, path.basename(this.#pkgPath), "src"))) {
|
|
232
|
-
realFilePath = path.resolve(this.#distPath, path.relative(path.resolve(this.#distPath, path.basename(this.#pkgPath), "src"), realFilePath));
|
|
233
|
-
if (fileName.endsWith(".js.map")) {
|
|
234
|
-
const sourceMapContents = JSON.parse(realText);
|
|
235
|
-
// remove "../../"
|
|
236
|
-
sourceMapContents.sources[0] = sourceMapContents.sources[0].slice(6);
|
|
237
|
-
realText = JSON.stringify(sourceMapContents);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
emittedFiles.push({
|
|
241
|
-
outRelPath: path.relative(this.#distPath, realFilePath),
|
|
242
|
-
text: realText
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
emittedFiles.push({ text });
|
|
247
|
-
}
|
|
248
|
-
}, undefined, undefined, this.#ngProgram?.compiler.prepareEmit().transformers);
|
|
249
|
-
if (!affectedFileResult) {
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
|
-
diagnostics.push(...affectedFileResult.result.diagnostics);
|
|
253
|
-
}
|
|
254
|
-
//-- global style
|
|
255
|
-
if (this.#globalStyleFilePath != null
|
|
256
|
-
&& !this.#stylesheetResultMap.has(this.#globalStyleFilePath)
|
|
257
|
-
&& FsUtil.exists(this.#globalStyleFilePath)) {
|
|
258
|
-
const data = await FsUtil.readFileAsync(this.#globalStyleFilePath);
|
|
259
|
-
const contents = await this.#bundleStylesheetAsync(data, this.#globalStyleFilePath, this.#globalStyleFilePath);
|
|
260
|
-
const emittedFiles = this.#emittedFilesCacheMap.getOrCreate(path.normalize(this.#globalStyleFilePath), []);
|
|
261
|
-
emittedFiles.push({
|
|
262
|
-
outRelPath: path.relative(path.resolve(this.#pkgPath, "src"), this.#globalStyleFilePath).replace(/\.scss$/, ".css"),
|
|
263
|
-
text: contents
|
|
264
|
-
});
|
|
265
|
-
this.#affectedFileSet.add(this.#globalStyleFilePath);
|
|
266
|
-
}
|
|
267
|
-
//-- init
|
|
268
|
-
this.#modifiedFileSet.clear();
|
|
269
|
-
//-- result
|
|
270
|
-
return {
|
|
271
|
-
program: this.#program,
|
|
272
|
-
typescriptDiagnostics: diagnostics,
|
|
273
|
-
stylesheetResultMap: this.#stylesheetResultMap,
|
|
274
|
-
emittedFilesCacheMap: this.#emittedFilesCacheMap,
|
|
275
|
-
watchFileSet: this.#watchFileSet,
|
|
276
|
-
affectedFileSet: this.#affectedFileSet
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
//# sourceMappingURL=SdTsCompiler2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SdTsCompiler2.js","sourceRoot":"","sources":["../../src/build-tools2/SdTsCompiler2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,MAAM,YAAY,CAAC;AAC/C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAC,mCAAmC,EAAC,MAAM,uDAAuD,CAAC;AAC1G,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,EACL,0BAA0B,EAC3B,MAAM,+EAA+E,CAAC;AAEvF,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAC,YAAY,EAAE,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAC;AAElC,MAAM,OAAO,aAAa;IACf,eAAe,CAAuB;IACtC,aAAa,CAAU;IAEvB,2BAA2B,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC7D,mBAAmB,GAAG,IAAI,GAAG,EAAyB,CAAC;IACvD,qBAAqB,GAAG,IAAI,GAAG,EAGlC,CAAC;IAEE,kBAAkB,CAAyC;IAC3D,aAAa,CAAwC;IAE9D,UAAU,CAA2B;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