@simplysm/sd-cli 11.0.40 → 11.1.2

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.
Files changed (55) hide show
  1. package/dist/build-cluster.d.ts +1 -1
  2. package/dist/build-cluster.js +181 -181
  3. package/dist/build-tools/SdCliCordova.d.ts +21 -21
  4. package/dist/build-tools/SdCliCordova.js +217 -217
  5. package/dist/build-tools/SdCliIndexFileGenerator.d.ts +5 -5
  6. package/dist/build-tools/SdCliIndexFileGenerator.js +50 -50
  7. package/dist/build-tools/SdCliNgRoutesFileGenerator.d.ts +4 -4
  8. package/dist/build-tools/SdCliNgRoutesFileGenerator.js +57 -57
  9. package/dist/build-tools/SdLinter.d.ts +5 -5
  10. package/dist/build-tools/SdLinter.js +54 -54
  11. package/dist/build-tools/SdNgBundler.d.ts +34 -35
  12. package/dist/build-tools/SdNgBundler.js +534 -533
  13. package/dist/build-tools/SdNgBundler.js.map +1 -1
  14. package/dist/build-tools/SdNgBundlerContext.d.ts +15 -16
  15. package/dist/build-tools/SdNgBundlerContext.js +97 -97
  16. package/dist/build-tools/SdNgBundlerContext.js.map +1 -1
  17. package/dist/build-tools/SdTsBundler.d.ts +15 -15
  18. package/dist/build-tools/SdTsBundler.js +87 -87
  19. package/dist/build-tools/SdTsCompiler.d.ts +29 -29
  20. package/dist/build-tools/SdTsCompiler.js +227 -227
  21. package/dist/builders/SdCliClientBuilder.d.ts +18 -18
  22. package/dist/builders/SdCliClientBuilder.js +129 -129
  23. package/dist/builders/SdCliJsLibLinter.d.ts +14 -14
  24. package/dist/builders/SdCliJsLibLinter.js +59 -59
  25. package/dist/builders/SdCliServerBuilder.d.ts +20 -20
  26. package/dist/builders/SdCliServerBuilder.js +215 -215
  27. package/dist/builders/SdCliTsLibBuilder.d.ts +17 -17
  28. package/dist/builders/SdCliTsLibBuilder.js +79 -79
  29. package/dist/commons.d.ts +132 -132
  30. package/dist/commons.js +1 -1
  31. package/dist/entry/SdCliElectron.d.ts +12 -12
  32. package/dist/entry/SdCliElectron.js +99 -99
  33. package/dist/entry/SdCliLocalUpdate.d.ts +12 -12
  34. package/dist/entry/SdCliLocalUpdate.js +90 -90
  35. package/dist/entry/SdCliProject.d.ts +26 -26
  36. package/dist/entry/SdCliProject.js +477 -477
  37. package/dist/index.d.ts +19 -19
  38. package/dist/index.js +19 -19
  39. package/dist/sd-cli.d.ts +2 -2
  40. package/dist/sd-cli.js +210 -210
  41. package/dist/server-worker.d.ts +1 -1
  42. package/dist/server-worker.js +38 -38
  43. package/dist/utils/SdCliBuildResultUtil.d.ts +6 -6
  44. package/dist/utils/SdCliBuildResultUtil.js +37 -37
  45. package/dist/utils/SdMemoryLoadResultCache.d.ts +10 -9
  46. package/dist/utils/SdMemoryLoadResultCache.js +36 -34
  47. package/dist/utils/SdMemoryLoadResultCache.js.map +1 -1
  48. package/dist/utils/SdSourceFileCache.d.ts +6 -6
  49. package/dist/utils/SdSourceFileCache.js +21 -14
  50. package/dist/utils/SdSourceFileCache.js.map +1 -1
  51. package/package.json +18 -18
  52. package/src/build-tools/SdNgBundler.ts +30 -36
  53. package/src/build-tools/SdNgBundlerContext.ts +11 -11
  54. package/src/utils/SdMemoryLoadResultCache.ts +4 -1
  55. package/src/utils/SdSourceFileCache.ts +10 -3
@@ -1,38 +1,38 @@
1
- import ts from "typescript";
2
- import os from "os";
3
- import path from "path";
4
- export class SdCliBuildResultUtil {
5
- static convertFromTsDiag(diag, type) {
6
- const severity = diag.category === ts.DiagnosticCategory.Error ? "error"
7
- : diag.category === ts.DiagnosticCategory.Warning ? "warning"
8
- : diag.category === ts.DiagnosticCategory.Suggestion ? "suggestion"
9
- : "message";
10
- const code = `TS${diag.code}`;
11
- const message = ts.flattenDiagnosticMessageText(diag.messageText, os.EOL);
12
- const filePath = diag.file ? path.resolve(diag.file.fileName) : undefined;
13
- const position = diag.file && diag.start !== undefined ? diag.file.getLineAndCharacterOfPosition(diag.start) : undefined;
14
- const line = position ? position.line + 1 : undefined;
15
- const char = position ? position.character + 1 : undefined;
16
- return {
17
- filePath: filePath !== undefined ? path.resolve(filePath) : undefined,
18
- line,
19
- char,
20
- code,
21
- severity,
22
- message,
23
- type: "build"
24
- };
25
- }
26
- static getMessage(result) {
27
- let str = "";
28
- if (result.filePath !== undefined) {
29
- str += `${result.filePath}(${result.line ?? 0}, ${result.char ?? 0}): `;
30
- }
31
- if (result.code !== undefined) {
32
- str += `${result.code}: `;
33
- }
34
- str += `(${result.type}) ${result.severity} ${result.message}`;
35
- return str;
36
- }
37
- }
1
+ import ts from "typescript";
2
+ import os from "os";
3
+ import path from "path";
4
+ export class SdCliBuildResultUtil {
5
+ static convertFromTsDiag(diag, type) {
6
+ const severity = diag.category === ts.DiagnosticCategory.Error ? "error"
7
+ : diag.category === ts.DiagnosticCategory.Warning ? "warning"
8
+ : diag.category === ts.DiagnosticCategory.Suggestion ? "suggestion"
9
+ : "message";
10
+ const code = `TS${diag.code}`;
11
+ const message = ts.flattenDiagnosticMessageText(diag.messageText, os.EOL);
12
+ const filePath = diag.file ? path.resolve(diag.file.fileName) : undefined;
13
+ const position = diag.file && diag.start !== undefined ? diag.file.getLineAndCharacterOfPosition(diag.start) : undefined;
14
+ const line = position ? position.line + 1 : undefined;
15
+ const char = position ? position.character + 1 : undefined;
16
+ return {
17
+ filePath: filePath !== undefined ? path.resolve(filePath) : undefined,
18
+ line,
19
+ char,
20
+ code,
21
+ severity,
22
+ message,
23
+ type: "build"
24
+ };
25
+ }
26
+ static getMessage(result) {
27
+ let str = "";
28
+ if (result.filePath !== undefined) {
29
+ str += `${result.filePath}(${result.line ?? 0}, ${result.char ?? 0}): `;
30
+ }
31
+ if (result.code !== undefined) {
32
+ str += `${result.code}: `;
33
+ }
34
+ str += `(${result.type}) ${result.severity} ${result.message}`;
35
+ return str;
36
+ }
37
+ }
38
38
  //# sourceMappingURL=SdCliBuildResultUtil.js.map
@@ -1,9 +1,10 @@
1
- import { MemoryLoadResultCache } from "@angular-devkit/build-angular/src/tools/esbuild/load-result-cache";
2
- import { OnLoadResult } from 'esbuild';
3
- export declare class SdMemoryLoadResultCache extends MemoryLoadResultCache {
4
- loadResults: Map<string, OnLoadResult>;
5
- fileDependencies: Map<string, Set<string>>;
6
- get(getPath: string): OnLoadResult | undefined;
7
- put(putPath: string, result: OnLoadResult): Promise<void>;
8
- invalidate(invalidatePath: string): boolean;
9
- }
1
+ import { MemoryLoadResultCache } from "@angular-devkit/build-angular/src/tools/esbuild/load-result-cache";
2
+ import { OnLoadResult } from 'esbuild';
3
+ export declare class SdMemoryLoadResultCache extends MemoryLoadResultCache {
4
+ loadResults: Map<string, OnLoadResult>;
5
+ fileDependencies: Map<string, Set<string>>;
6
+ get(getPath: string): OnLoadResult | undefined;
7
+ put(putPath: string, result: OnLoadResult): Promise<void>;
8
+ invalidate(invalidatePath: string): boolean;
9
+ get watchFiles(): string[];
10
+ }
@@ -1,35 +1,37 @@
1
- import { MemoryLoadResultCache } from "@angular-devkit/build-angular/src/tools/esbuild/load-result-cache";
2
- import path from "path";
3
- export class SdMemoryLoadResultCache extends MemoryLoadResultCache {
4
- constructor() {
5
- super(...arguments);
6
- this.loadResults = new Map();
7
- this.fileDependencies = new Map();
8
- }
9
- get(getPath) {
10
- return this.loadResults.get(getPath);
11
- }
12
- put(putPath, result) {
13
- this.loadResults.set(putPath, result);
14
- if (result.watchFiles) {
15
- for (const watchFile of result.watchFiles) {
16
- // Normalize the watch file path to ensure OS consistent paths
17
- const watchFilePath = path.resolve(watchFile);
18
- let affected = this.fileDependencies.getOrCreate(watchFilePath, new Set());
19
- affected.add(putPath);
20
- }
21
- }
22
- return Promise.resolve();
23
- }
24
- invalidate(invalidatePath) {
25
- const affected = this.fileDependencies.get(invalidatePath);
26
- let found = false;
27
- if (affected) {
28
- affected.forEach((a) => (found ||= this.loadResults.delete(a)));
29
- this.fileDependencies.delete(invalidatePath);
30
- }
31
- found ||= this.loadResults.delete(invalidatePath);
32
- return found;
33
- }
34
- }
1
+ import { MemoryLoadResultCache } from "@angular-devkit/build-angular/src/tools/esbuild/load-result-cache";
2
+ import path from "path";
3
+ export class SdMemoryLoadResultCache extends MemoryLoadResultCache {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.loadResults = new Map();
7
+ this.fileDependencies = new Map();
8
+ }
9
+ get(getPath) {
10
+ return this.loadResults.get(getPath);
11
+ }
12
+ put(putPath, result) {
13
+ this.loadResults.set(putPath, result);
14
+ if (result.watchFiles) {
15
+ for (const watchFile of result.watchFiles) {
16
+ const watchFilePath = path.resolve(watchFile);
17
+ let affected = this.fileDependencies.getOrCreate(watchFilePath, new Set());
18
+ affected.add(putPath);
19
+ }
20
+ }
21
+ return Promise.resolve();
22
+ }
23
+ invalidate(invalidatePath) {
24
+ const affected = this.fileDependencies.get(invalidatePath);
25
+ let found = false;
26
+ if (affected) {
27
+ affected.forEach((a) => (found ||= this.loadResults.delete(a)));
28
+ this.fileDependencies.delete(invalidatePath);
29
+ }
30
+ found ||= this.loadResults.delete(invalidatePath);
31
+ return found;
32
+ }
33
+ get watchFiles() {
34
+ return [...this.loadResults.keys(), ...this.fileDependencies.keys()];
35
+ }
36
+ }
35
37
  //# sourceMappingURL=SdMemoryLoadResultCache.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SdMemoryLoadResultCache.js","sourceRoot":"","sources":["../../src/utils/SdMemoryLoadResultCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAC,MAAM,mEAAmE,CAAC;AAExG,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,OAAO,uBAAwB,SAAQ,qBAAqB;IAAlE;;QACE,gBAAW,GAAG,IAAI,GAAG,EAAwB,CAAC;QAC9C,qBAAgB,GAAG,IAAI,GAAG,EAAuB,CAAC;IAiCpD,CAAC;IA/BU,GAAG,CAAC,OAAe;QAC1B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAEQ,GAAG,CA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IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC;IACvE,CAAC;CACF"}
@@ -1,6 +1,6 @@
1
- import { SdMemoryLoadResultCache } from "./SdMemoryLoadResultCache";
2
- import { SourceFileCache } from "@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin";
3
- export declare class SdSourceFileCache extends SourceFileCache {
4
- readonly loadResultCache: SdMemoryLoadResultCache;
5
- invalidate(files: Iterable<string>): void;
6
- }
1
+ import { SdMemoryLoadResultCache } from "./SdMemoryLoadResultCache";
2
+ import { SourceFileCache } from "@angular-devkit/build-angular/src/tools/esbuild/angular/source-file-cache";
3
+ export declare class SdSourceFileCache extends SourceFileCache {
4
+ readonly loadResultCache: SdMemoryLoadResultCache;
5
+ invalidate(files: Iterable<string>): void;
6
+ }
@@ -1,15 +1,22 @@
1
- import { SdMemoryLoadResultCache } from "./SdMemoryLoadResultCache";
2
- import { SourceFileCache } from "@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin";
3
- export class SdSourceFileCache extends SourceFileCache {
4
- constructor() {
5
- super(...arguments);
6
- this.loadResultCache = new SdMemoryLoadResultCache();
7
- }
8
- invalidate(files) {
9
- super.invalidate(files);
10
- for (let file of files) {
11
- this.loadResultCache.invalidate(file);
12
- }
13
- }
14
- }
1
+ import { SdMemoryLoadResultCache } from "./SdMemoryLoadResultCache";
2
+ import { SourceFileCache } from "@angular-devkit/build-angular/src/tools/esbuild/angular/source-file-cache";
3
+ import { pathToFileURL } from "url";
4
+ export class SdSourceFileCache extends SourceFileCache {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.loadResultCache = new SdMemoryLoadResultCache();
8
+ }
9
+ invalidate(files) {
10
+ if (files !== this.modifiedFiles) {
11
+ this.modifiedFiles.clear();
12
+ }
13
+ for (let file of files) {
14
+ this.babelFileCache.delete(file);
15
+ this.typeScriptFileCache.delete(pathToFileURL(file).href);
16
+ this.loadResultCache.invalidate(file);
17
+ this.delete(file);
18
+ this.modifiedFiles.add(file);
19
+ }
20
+ }
21
+ }
15
22
  //# sourceMappingURL=SdSourceFileCache.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SdSourceFileCache.js","sourceRoot":"","sources":["../../src/utils/SdSourceFileCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAC,eAAe,EAAC,MAAM,yEAAyE,CAAC;AAExG,MAAM,OAAO,iBAAkB,SAAQ,eAAe;IAAtD;;QACoB,oBAAe,GAAG,IAAI,uBAAuB,EAAE,CAAC;IASpE,CAAC;IAPU,UAAU,CAAC,KAAuB;QACzC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAExB,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE;YACtB,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SACvC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"SdSourceFileCache.js","sourceRoot":"","sources":["../../src/utils/SdSourceFileCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAC,eAAe,EAAC,MAAM,2EAA2E,CAAC;AAC1G,OAAO,EAAC,aAAa,EAAC,MAAM,KAAK,CAAC;AAElC,MAAM,OAAO,iBAAkB,SAAQ,eAAe;IAAtD;;QACoB,oBAAe,GAAG,IAAI,uBAAuB,EAAE,CAAC;IAepE,CAAC;IAbU,UAAU,CAAC,KAAuB;QACzC,IAAI,KAAK,KAAK,IAAI,CAAC,aAAa,EAAE;YAChC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;SAC5B;QACD,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE;YACtB,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACjC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;YAC1D,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAEtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAClB,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAC9B;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/sd-cli",
3
- "version": "11.0.40",
3
+ "version": "11.1.2",
4
4
  "description": "심플리즘 패키지 - CLI",
5
5
  "author": "김석래",
6
6
  "repository": {
@@ -17,21 +17,21 @@
17
17
  "node": "^18"
18
18
  },
19
19
  "dependencies": {
20
- "@angular-devkit/build-angular": "^16.2.9",
21
- "@angular/common": "^16.2.12",
22
- "@angular/compiler": "^16.2.12",
23
- "@angular/compiler-cli": "^16.2.12",
24
- "@angular/core": "^16.2.12",
20
+ "@angular-devkit/build-angular": "^17.0.0",
21
+ "@angular/common": "^17.0.1",
22
+ "@angular/compiler": "^17.0.1",
23
+ "@angular/compiler-cli": "^17.0.1",
24
+ "@angular/core": "^17.0.1",
25
25
  "@electron/rebuild": "^3.3.0",
26
- "@simplysm/sd-core-common": "11.0.40",
27
- "@simplysm/sd-core-node": "11.0.40",
28
- "@simplysm/sd-service-server": "11.0.40",
29
- "@simplysm/sd-storage": "11.0.40",
26
+ "@simplysm/sd-core-common": "11.1.2",
27
+ "@simplysm/sd-core-node": "11.1.2",
28
+ "@simplysm/sd-service-server": "11.1.2",
29
+ "@simplysm/sd-storage": "11.1.2",
30
30
  "browserslist": "^4.22.1",
31
31
  "cordova": "^12.0.0",
32
- "electron": "^27.0.3",
33
- "electron-builder": "^24.8.0",
34
- "esbuild": "0.18.17",
32
+ "electron": "^27.0.4",
33
+ "electron-builder": "^24.8.1",
34
+ "esbuild": "^0.19.5",
35
35
  "esbuild-plugin-tsc": "^0.4.0",
36
36
  "eslint": "^8.53.0",
37
37
  "jszip": "^3.10.1",
@@ -41,14 +41,14 @@
41
41
  "semver": "^7.5.4",
42
42
  "xml2js": "^0.6.2",
43
43
  "yargs": "^17.7.2",
44
- "zone.js": "~0.13.3"
44
+ "zone.js": "~0.14.2"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/eslint": "^8.44.6",
48
- "@types/xml2js": "^0.4.13",
49
- "@types/yargs": "^17.0.29"
47
+ "@types/eslint": "^8.44.7",
48
+ "@types/xml2js": "^0.4.14",
49
+ "@types/yargs": "^17.0.31"
50
50
  },
51
51
  "peerDependencies": {
52
- "typescript": "^4.9.5"
52
+ "typescript": "~5.2.2"
53
53
  }
54
54
  }
@@ -1,9 +1,13 @@
1
1
  import {createCompilerPlugin} from "@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin";
2
2
  import path from "path";
3
- import {InitialFileRecord} from "@angular-devkit/build-angular/src/tools/esbuild/bundler-context";
3
+ import {
4
+ BuildOutputFile,
5
+ BuildOutputFileType,
6
+ InitialFileRecord
7
+ } from "@angular-devkit/build-angular/src/tools/esbuild/bundler-context";
4
8
  import esbuild, {Metafile} from "esbuild";
5
9
  import {FsUtil, PathUtil} from "@simplysm/sd-core-node";
6
- import {fileURLToPath, pathToFileURL} from "url";
10
+ import {fileURLToPath} from "url";
7
11
  import {createVirtualModulePlugin} from "@angular-devkit/build-angular/src/tools/esbuild/virtual-module-plugin";
8
12
  import {
9
13
  createSourcemapIgnorelistPlugin
@@ -16,6 +20,7 @@ import {extractLicenses} from "@angular-devkit/build-angular/src/tools/esbuild/l
16
20
  import {augmentAppWithServiceWorkerEsbuild} from "@angular-devkit/build-angular/src/utils/service-worker";
17
21
  import browserslist from "browserslist";
18
22
  import {
23
+ convertOutputFile,
19
24
  createOutputFileFromText,
20
25
  transformSupportedBrowsersToTargets
21
26
  } from "@angular-devkit/build-angular/src/tools/esbuild/utils";
@@ -45,8 +50,6 @@ export class SdNgBundler {
45
50
 
46
51
  private readonly _outputCache = new Map<string, string | number>();
47
52
 
48
- private readonly _customDepsCache = new Map<string, Set<string>>();
49
-
50
53
  private readonly _pkgNpmConf: INpmConfig;
51
54
  private readonly _mainFilePath: string;
52
55
  private readonly _tsConfigFilePath: string;
@@ -75,17 +78,7 @@ export class SdNgBundler {
75
78
  }
76
79
 
77
80
  public removeCache(filePaths: string[]): void {
78
- for (const filePath of filePaths) {
79
- const depsSet = this._customDepsCache.get(filePath);
80
- if (depsSet) {
81
- for (const depFile of depsSet) {
82
- this._sourceFileCache.invalidate([depFile]);
83
- }
84
- }
85
- else {
86
- this._sourceFileCache.invalidate([filePath]);
87
- }
88
- }
81
+ this._sourceFileCache.invalidate(filePaths);
89
82
  }
90
83
 
91
84
  public async bundleAsync(): Promise<{
@@ -105,16 +98,21 @@ export class SdNgBundler {
105
98
  const results = bundlingResults.mapMany(bundlingResult => bundlingResult.results);
106
99
 
107
100
  const watchFilePaths = [
108
- ...this._sourceFileCache.keys(),
101
+ ...Array.from(this._sourceFileCache.typeScriptFileCache.keys()).map(item => fileURLToPath(item)),
102
+ ...this._sourceFileCache.referencedFiles ?? [],
109
103
  ...this._sourceFileCache.babelFileCache.keys(),
110
- ...this._sourceFileCache.loadResultCache.fileDependencies.keys(),
111
- ...this._customDepsCache.keys()
104
+ ...this._sourceFileCache.loadResultCache.watchFiles
112
105
  ].map((item) => path.resolve(item)).distinct();
113
106
 
114
107
  let affectedSourceFilePaths = watchFilePaths.filter((item) => PathUtil.isChildPath(item, this._opt.pkgPath));
115
108
 
116
109
  if (this._sourceFileCache.modifiedFiles.size > 0) {
117
- const depMap = new Map<string, Set<string>>();
110
+ affectedSourceFilePaths = Array.from(this._sourceFileCache.modifiedFiles)
111
+ .filter((item) => PathUtil.isChildPath(item, this._opt.pkgPath))
112
+ .map((item) => path.resolve(item))
113
+ .distinct();
114
+
115
+ /*const depMap = new Map<string, Set<string>>();
118
116
  for (const bundlingResult of bundlingResults) {
119
117
  for (const [k, v] of bundlingResult.dependencyMap) {
120
118
  const currSet = depMap.getOrCreate(k, new Set<string>());
@@ -125,10 +123,6 @@ export class SdNgBundler {
125
123
  const currSet = depMap.getOrCreate(k, new Set<string>());
126
124
  currSet.adds(...Array.from(v).map((item) => item.startsWith("file:") ? fileURLToPath(item) : undefined).filterExists());
127
125
  }
128
- for (const [k, v] of this._customDepsCache) {
129
- const currSet = depMap.getOrCreate(k, new Set<string>());
130
- currSet.adds(...v);
131
- }
132
126
 
133
127
  const searchAffectedFiles = (filePath: string, prev?: Set<string>): Set<string> => {
134
128
  const result = new Set<string>(prev);
@@ -150,13 +144,13 @@ export class SdNgBundler {
150
144
  affectedFilePathSet.add(path.resolve(modFile));
151
145
  affectedFilePathSet.adds(...searchAffectedFiles(path.resolve(modFile)));
152
146
  }
153
- affectedSourceFilePaths = Array.from(affectedFilePathSet.values()).filter((item) => PathUtil.isChildPath(item, this._opt.pkgPath));
147
+ affectedSourceFilePaths = Array.from(affectedFilePathSet.values()).filter((item) => PathUtil.isChildPath(item, this._opt.pkgPath));*/
154
148
  }
155
149
 
156
150
  /*const executionResult = new ExecutionResult(this._contexts, this._sourceFileCache);
157
151
  executionResult.outputFiles.push(...bundlingResult.outputFiles);*/
158
152
 
159
- const outputFiles = bundlingResults.mapMany(item => item.outputFiles ?? []);
153
+ const outputFiles: BuildOutputFile[] = bundlingResults.mapMany(item => item.outputFiles?.map(file => convertOutputFile(file, BuildOutputFileType.Root)) ?? []);
160
154
  const initialFiles = new Map<string, InitialFileRecord>();
161
155
  const metafile: {
162
156
  inputs: Metafile["inputs"],
@@ -190,7 +184,7 @@ export class SdNgBundler {
190
184
 
191
185
  //-- cordova empty
192
186
  if (this._opt.cordovaConfig?.plugins) {
193
- outputFiles.push(createOutputFileFromText("cordova-empty.js", "export default {};"));
187
+ outputFiles.push(createOutputFileFromText("cordova-empty.js", "export default {};", BuildOutputFileType.Root));
194
188
  }
195
189
 
196
190
  //-- index
@@ -218,21 +212,21 @@ export class SdNgBundler {
218
212
  type: "build",
219
213
  });
220
214
  }
221
- outputFiles.push(createOutputFileFromText("index.html", genIndexHtmlResult.content));
215
+ outputFiles.push(createOutputFileFromText("index.html", genIndexHtmlResult.content, BuildOutputFileType.Root));
222
216
 
223
217
  //-- copy assets
224
218
  assetFiles.push(...(await this._copyAssetsAsync()));
225
219
 
226
220
  //-- extract 3rdpartylicenses
227
221
  if (!this._opt.dev) {
228
- outputFiles.push(createOutputFileFromText('3rdpartylicenses.txt', await extractLicenses(metafile, this._opt.pkgPath)));
222
+ outputFiles.push(createOutputFileFromText('3rdpartylicenses.txt', await extractLicenses(metafile, this._opt.pkgPath), BuildOutputFileType.Root));
229
223
  }
230
224
 
231
225
  //-- service worker
232
226
  if (FsUtil.exists(this._swConfFilePath)) {
233
227
  try {
234
228
  const serviceWorkerResult = await this._genServiceWorkerAsync(outputFiles, assetFiles);
235
- outputFiles.push(createOutputFileFromText('ngsw.json', serviceWorkerResult.manifest));
229
+ outputFiles.push(createOutputFileFromText('ngsw.json', serviceWorkerResult.manifest, BuildOutputFileType.Root));
236
230
  assetFiles.push(...serviceWorkerResult.assetFiles);
237
231
  }
238
232
  catch (err) {
@@ -250,8 +244,7 @@ export class SdNgBundler {
250
244
 
251
245
  //-- write
252
246
  for (const outputFile of outputFiles) {
253
- const distFilePath = path.resolve(this._opt.outputPath, outputFile.path);
254
-
247
+ const distFilePath = path.resolve(this._opt.outputPath, outputFile.fullOutputPath);
255
248
  const prev = this._outputCache.get(distFilePath);
256
249
  if (prev !== Buffer.from(outputFile.contents).toString("base64")) {
257
250
  await FsUtil.writeFileAsync(distFilePath, outputFile.contents);
@@ -395,7 +388,7 @@ export class SdNgBundler {
395
388
  }
396
389
 
397
390
  private async _genServiceWorkerAsync(
398
- outputFiles: esbuild.OutputFile[],
391
+ outputFiles: BuildOutputFile[],
399
392
  assetFiles: {
400
393
  source: string;
401
394
  destination: string;
@@ -494,7 +487,7 @@ export class SdNgBundler {
494
487
  },
495
488
  inject: [PathUtil.posix(fileURLToPath(await import.meta.resolve!("node-stdlib-browser/helpers/esbuild/shim")))],
496
489
  plugins: [
497
- {
490
+ /*{
498
491
  name: "sd-worker",
499
492
  setup: ({onLoad}) => {
500
493
  onLoad({filter: /\.ts$/}, async args => {
@@ -558,7 +551,7 @@ export class SdNgBundler {
558
551
  return undefined;
559
552
  });
560
553
  }
561
- },
554
+ },*/
562
555
  ...this._opt.cordovaConfig?.plugins ? [{
563
556
  name: "cordova:plugin-empty",
564
557
  setup: ({onResolve}) => {
@@ -581,13 +574,14 @@ export class SdNgBundler {
581
574
  createSourcemapIgnorelistPlugin(),
582
575
  createCompilerPlugin({
583
576
  sourcemap: this._opt.dev,
584
- thirdPartySourcemaps: false,
585
577
  tsconfig: this._tsConfigFilePath,
586
578
  jit: false,
587
579
  advancedOptimizations: true,
580
+ thirdPartySourcemaps: false,
588
581
  fileReplacements: undefined,
589
582
  sourceFileCache: this._sourceFileCache,
590
- loadResultCache: this._sourceFileCache.loadResultCache
583
+ loadResultCache: this._sourceFileCache.loadResultCache,
584
+ incremental: this._opt.dev
591
585
  }, {
592
586
  workspaceRoot: this._opt.pkgPath,
593
587
  optimization: !this._opt.dev,
@@ -53,7 +53,7 @@ export class SdNgBundlerContext {
53
53
  const initialFiles = new Map<string, InitialFileRecord>();
54
54
 
55
55
  for (const outputFile of buildResult.outputFiles ?? []) {
56
- const relativeFilePath = path.relative(this._pkgPath, outputFile.path);
56
+ const relativeFilePath = path.isAbsolute(outputFile.path) ? path.relative(this._pkgPath, outputFile.path) : outputFile.path;
57
57
  const entryPoint = buildResult.metafile?.outputs[relativeFilePath]?.entryPoint;
58
58
 
59
59
  outputFile.path = relativeFilePath;
@@ -95,21 +95,21 @@ export class SdNgBundlerContext {
95
95
  }
96
96
  }
97
97
 
98
- const dependencyMap = new Map<string, Set<string>>();
99
- if (buildResult.metafile) {
100
- for (const [key, val] of Object.entries(buildResult.metafile.inputs)) {
101
- for (const imp of val.imports) {
102
- const deps = dependencyMap.getOrCreate(path.resolve(this._pkgPath, imp.path), new Set<string>());
103
- deps.add(path.resolve(this._pkgPath, key));
104
- }
105
- }
106
- }
98
+ // const dependencyMap = new Map<string, Set<string>>();
99
+ // if (buildResult.metafile) {
100
+ // for (const [key, val] of Object.entries(buildResult.metafile.inputs)) {
101
+ // for (const imp of val.imports) {
102
+ // const deps = dependencyMap.getOrCreate(path.resolve(this._pkgPath, imp.path), new Set<string>());
103
+ // deps.add(path.resolve(this._pkgPath, key));
104
+ // }
105
+ // }
106
+ // }
107
107
 
108
108
  return {
109
109
  results,
110
110
  initialFiles,
111
111
  outputFiles: buildResult.outputFiles,
112
- dependencyMap,
112
+ // dependencyMap,
113
113
  metafile: buildResult.metafile
114
114
  };
115
115
  }
@@ -14,7 +14,6 @@ export class SdMemoryLoadResultCache extends MemoryLoadResultCache {
14
14
  this.loadResults.set(putPath, result);
15
15
  if (result.watchFiles) {
16
16
  for (const watchFile of result.watchFiles) {
17
- // Normalize the watch file path to ensure OS consistent paths
18
17
  const watchFilePath = path.resolve(watchFile);
19
18
  let affected = this.fileDependencies.getOrCreate(watchFilePath, new Set());
20
19
  affected.add(putPath);
@@ -37,4 +36,8 @@ export class SdMemoryLoadResultCache extends MemoryLoadResultCache {
37
36
 
38
37
  return found;
39
38
  }
39
+
40
+ override get watchFiles(): string[] {
41
+ return [...this.loadResults.keys(), ...this.fileDependencies.keys()];
42
+ }
40
43
  }
@@ -1,14 +1,21 @@
1
1
  import {SdMemoryLoadResultCache} from "./SdMemoryLoadResultCache";
2
- import {SourceFileCache} from "@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin";
2
+ import {SourceFileCache} from "@angular-devkit/build-angular/src/tools/esbuild/angular/source-file-cache";
3
+ import {pathToFileURL} from "url";
3
4
 
4
5
  export class SdSourceFileCache extends SourceFileCache {
5
6
  override readonly loadResultCache = new SdMemoryLoadResultCache();
6
7
 
7
8
  override invalidate(files: Iterable<string>): void {
8
- super.invalidate(files);
9
-
9
+ if (files !== this.modifiedFiles) {
10
+ this.modifiedFiles.clear();
11
+ }
10
12
  for (let file of files) {
13
+ this.babelFileCache.delete(file);
14
+ this.typeScriptFileCache.delete(pathToFileURL(file).href);
11
15
  this.loadResultCache.invalidate(file);
16
+
17
+ this.delete(file);
18
+ this.modifiedFiles.add(file);
12
19
  }
13
20
  }
14
21
  }