@simplysm/sd-cli 11.0.40 → 11.1.1

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 (51) 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 +35 -35
  12. package/dist/build-tools/SdNgBundler.js +545 -533
  13. package/dist/build-tools/SdNgBundler.js.map +1 -1
  14. package/dist/build-tools/SdNgBundlerContext.d.ts +16 -16
  15. package/dist/build-tools/SdNgBundlerContext.js +97 -97
  16. package/dist/build-tools/SdTsBundler.d.ts +15 -15
  17. package/dist/build-tools/SdTsBundler.js +87 -87
  18. package/dist/build-tools/SdTsCompiler.d.ts +29 -29
  19. package/dist/build-tools/SdTsCompiler.js +227 -227
  20. package/dist/builders/SdCliClientBuilder.d.ts +18 -18
  21. package/dist/builders/SdCliClientBuilder.js +129 -129
  22. package/dist/builders/SdCliJsLibLinter.d.ts +14 -14
  23. package/dist/builders/SdCliJsLibLinter.js +59 -59
  24. package/dist/builders/SdCliServerBuilder.d.ts +20 -20
  25. package/dist/builders/SdCliServerBuilder.js +215 -215
  26. package/dist/builders/SdCliTsLibBuilder.d.ts +17 -17
  27. package/dist/builders/SdCliTsLibBuilder.js +79 -79
  28. package/dist/commons.d.ts +132 -132
  29. package/dist/commons.js +1 -1
  30. package/dist/entry/SdCliElectron.d.ts +12 -12
  31. package/dist/entry/SdCliElectron.js +99 -99
  32. package/dist/entry/SdCliLocalUpdate.d.ts +12 -12
  33. package/dist/entry/SdCliLocalUpdate.js +90 -90
  34. package/dist/entry/SdCliProject.d.ts +26 -26
  35. package/dist/entry/SdCliProject.js +477 -477
  36. package/dist/index.d.ts +19 -19
  37. package/dist/index.js +19 -19
  38. package/dist/sd-cli.d.ts +2 -2
  39. package/dist/sd-cli.js +210 -210
  40. package/dist/server-worker.d.ts +1 -1
  41. package/dist/server-worker.js +38 -38
  42. package/dist/utils/SdCliBuildResultUtil.d.ts +6 -6
  43. package/dist/utils/SdCliBuildResultUtil.js +37 -37
  44. package/dist/utils/SdMemoryLoadResultCache.d.ts +9 -9
  45. package/dist/utils/SdMemoryLoadResultCache.js +34 -34
  46. package/dist/utils/SdSourceFileCache.d.ts +6 -6
  47. package/dist/utils/SdSourceFileCache.js +14 -14
  48. package/dist/utils/SdSourceFileCache.js.map +1 -1
  49. package/package.json +18 -18
  50. package/src/build-tools/SdNgBundler.ts +21 -12
  51. package/src/utils/SdSourceFileCache.ts +1 -1
@@ -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,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
- }
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,35 +1,35 @@
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
+ // 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
+ }
35
35
  //# sourceMappingURL=SdMemoryLoadResultCache.js.map
@@ -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,15 @@
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
+ 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
+ }
15
15
  //# 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;AAE1G,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"}
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.1",
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.1",
27
+ "@simplysm/sd-core-node": "11.1.1",
28
+ "@simplysm/sd-service-server": "11.1.1",
29
+ "@simplysm/sd-storage": "11.1.1",
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";
@@ -156,7 +161,10 @@ export class SdNgBundler {
156
161
  /*const executionResult = new ExecutionResult(this._contexts, this._sourceFileCache);
157
162
  executionResult.outputFiles.push(...bundlingResult.outputFiles);*/
158
163
 
159
- const outputFiles = bundlingResults.mapMany(item => item.outputFiles ?? []);
164
+ const outputFiles: BuildOutputFile[] = bundlingResults.mapMany(item => item.outputFiles?.map(file => {
165
+ const fileType = path.dirname(file.path) === 'media' ? BuildOutputFileType.Media : BuildOutputFileType.Browser;
166
+ return convertOutputFile(file, fileType);
167
+ }) ?? []);
160
168
  const initialFiles = new Map<string, InitialFileRecord>();
161
169
  const metafile: {
162
170
  inputs: Metafile["inputs"],
@@ -190,7 +198,7 @@ export class SdNgBundler {
190
198
 
191
199
  //-- cordova empty
192
200
  if (this._opt.cordovaConfig?.plugins) {
193
- outputFiles.push(createOutputFileFromText("cordova-empty.js", "export default {};"));
201
+ outputFiles.push(createOutputFileFromText("cordova-empty.js", "export default {};", BuildOutputFileType.Browser));
194
202
  }
195
203
 
196
204
  //-- index
@@ -218,21 +226,21 @@ export class SdNgBundler {
218
226
  type: "build",
219
227
  });
220
228
  }
221
- outputFiles.push(createOutputFileFromText("index.html", genIndexHtmlResult.content));
229
+ outputFiles.push(createOutputFileFromText("index.html", genIndexHtmlResult.content, BuildOutputFileType.Browser));
222
230
 
223
231
  //-- copy assets
224
232
  assetFiles.push(...(await this._copyAssetsAsync()));
225
233
 
226
234
  //-- extract 3rdpartylicenses
227
235
  if (!this._opt.dev) {
228
- outputFiles.push(createOutputFileFromText('3rdpartylicenses.txt', await extractLicenses(metafile, this._opt.pkgPath)));
236
+ outputFiles.push(createOutputFileFromText('3rdpartylicenses.txt', await extractLicenses(metafile, this._opt.pkgPath), BuildOutputFileType.Root));
229
237
  }
230
238
 
231
239
  //-- service worker
232
240
  if (FsUtil.exists(this._swConfFilePath)) {
233
241
  try {
234
242
  const serviceWorkerResult = await this._genServiceWorkerAsync(outputFiles, assetFiles);
235
- outputFiles.push(createOutputFileFromText('ngsw.json', serviceWorkerResult.manifest));
243
+ outputFiles.push(createOutputFileFromText('ngsw.json', serviceWorkerResult.manifest, BuildOutputFileType.Browser));
236
244
  assetFiles.push(...serviceWorkerResult.assetFiles);
237
245
  }
238
246
  catch (err) {
@@ -395,7 +403,7 @@ export class SdNgBundler {
395
403
  }
396
404
 
397
405
  private async _genServiceWorkerAsync(
398
- outputFiles: esbuild.OutputFile[],
406
+ outputFiles: BuildOutputFile[],
399
407
  assetFiles: {
400
408
  source: string;
401
409
  destination: string;
@@ -494,7 +502,7 @@ export class SdNgBundler {
494
502
  },
495
503
  inject: [PathUtil.posix(fileURLToPath(await import.meta.resolve!("node-stdlib-browser/helpers/esbuild/shim")))],
496
504
  plugins: [
497
- {
505
+ /*{
498
506
  name: "sd-worker",
499
507
  setup: ({onLoad}) => {
500
508
  onLoad({filter: /\.ts$/}, async args => {
@@ -558,7 +566,7 @@ export class SdNgBundler {
558
566
  return undefined;
559
567
  });
560
568
  }
561
- },
569
+ },*/
562
570
  ...this._opt.cordovaConfig?.plugins ? [{
563
571
  name: "cordova:plugin-empty",
564
572
  setup: ({onResolve}) => {
@@ -581,13 +589,14 @@ export class SdNgBundler {
581
589
  createSourcemapIgnorelistPlugin(),
582
590
  createCompilerPlugin({
583
591
  sourcemap: this._opt.dev,
584
- thirdPartySourcemaps: false,
585
592
  tsconfig: this._tsConfigFilePath,
586
593
  jit: false,
587
594
  advancedOptimizations: true,
595
+ thirdPartySourcemaps: false,
588
596
  fileReplacements: undefined,
589
597
  sourceFileCache: this._sourceFileCache,
590
- loadResultCache: this._sourceFileCache.loadResultCache
598
+ loadResultCache: this._sourceFileCache.loadResultCache,
599
+ incremental: this._opt.dev
591
600
  }, {
592
601
  workspaceRoot: this._opt.pkgPath,
593
602
  optimization: !this._opt.dev,
@@ -1,5 +1,5 @@
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
3
 
4
4
  export class SdSourceFileCache extends SourceFileCache {
5
5
  override readonly loadResultCache = new SdMemoryLoadResultCache();