@simplysm/sd-cli 12.11.6 → 12.11.8

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 (88) hide show
  1. package/dist/entry/sd-cli-cordova.d.ts +2 -34
  2. package/dist/entry/sd-cli-cordova.js +89 -85
  3. package/dist/entry/sd-cli-cordova.js.map +1 -1
  4. package/dist/entry/sd-cli-electron.d.ts +1 -5
  5. package/dist/entry/sd-cli-electron.js +21 -21
  6. package/dist/entry/sd-cli-electron.js.map +1 -1
  7. package/dist/entry/sd-cli-local-update.d.ts +1 -1
  8. package/dist/entry/sd-cli-local-update.js +3 -3
  9. package/dist/entry/sd-cli-local-update.js.map +1 -1
  10. package/dist/entry/sd-cli-project.d.ts +1 -4
  11. package/dist/entry/sd-cli-project.js +11 -11
  12. package/dist/entry/sd-cli-project.js.map +1 -1
  13. package/dist/fix/convert-private-to-hash.d.ts +1 -0
  14. package/dist/fix/convert-private-to-hash.js +59 -0
  15. package/dist/fix/convert-private-to-hash.js.map +1 -0
  16. package/dist/pkg-builders/client/sd-client.build-runner.d.ts +1 -2
  17. package/dist/pkg-builders/client/sd-client.build-runner.js +11 -9
  18. package/dist/pkg-builders/client/sd-client.build-runner.js.map +1 -1
  19. package/dist/pkg-builders/client/sd-ng.bundler-context.d.ts +3 -5
  20. package/dist/pkg-builders/client/sd-ng.bundler-context.js +10 -9
  21. package/dist/pkg-builders/client/sd-ng.bundler-context.js.map +1 -1
  22. package/dist/pkg-builders/client/sd-ng.bundler.d.ts +2 -22
  23. package/dist/pkg-builders/client/sd-ng.bundler.js +76 -67
  24. package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -1
  25. package/dist/pkg-builders/commons/scope-path.d.ts +1 -1
  26. package/dist/pkg-builders/commons/scope-path.js +4 -3
  27. package/dist/pkg-builders/commons/scope-path.js.map +1 -1
  28. package/dist/pkg-builders/lib/sd-cli-index.file-generator.d.ts +1 -1
  29. package/dist/pkg-builders/lib/sd-cli-index.file-generator.js +2 -2
  30. package/dist/pkg-builders/lib/sd-cli-index.file-generator.js.map +1 -1
  31. package/dist/pkg-builders/lib/sd-js-lib.build-runner.d.ts +1 -1
  32. package/dist/pkg-builders/lib/sd-js-lib.build-runner.js +2 -2
  33. package/dist/pkg-builders/lib/sd-js-lib.build-runner.js.map +1 -1
  34. package/dist/pkg-builders/lib/sd-ts-lib.build-runner.d.ts +1 -1
  35. package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js +3 -2
  36. package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +1 -1
  37. package/dist/pkg-builders/lib/sd-ts-lib.builder.d.ts +2 -2
  38. package/dist/pkg-builders/lib/sd-ts-lib.builder.js +3 -2
  39. package/dist/pkg-builders/lib/sd-ts-lib.builder.js.map +1 -1
  40. package/dist/pkg-builders/sd-multi.build-runner.d.ts +1 -6
  41. package/dist/pkg-builders/sd-multi.build-runner.js +27 -30
  42. package/dist/pkg-builders/sd-multi.build-runner.js.map +1 -1
  43. package/dist/pkg-builders/server/sd-server.build-runner.d.ts +1 -4
  44. package/dist/pkg-builders/server/sd-server.build-runner.js +11 -9
  45. package/dist/pkg-builders/server/sd-server.build-runner.js.map +1 -1
  46. package/dist/pkg-builders/server/sd-server.bundler.d.ts +2 -6
  47. package/dist/pkg-builders/server/sd-server.bundler.js +19 -18
  48. package/dist/pkg-builders/server/sd-server.bundler.js.map +1 -1
  49. package/dist/sd-cli-entry.js +17 -7
  50. package/dist/sd-cli-entry.js.map +1 -1
  51. package/dist/ts-compiler/sd-dependency-cache.d.ts +1 -8
  52. package/dist/ts-compiler/sd-dependency-cache.js +37 -39
  53. package/dist/ts-compiler/sd-dependency-cache.js.map +1 -1
  54. package/dist/ts-compiler/sd-ts-compiler.d.ts +1 -19
  55. package/dist/ts-compiler/sd-ts-compiler.js +112 -107
  56. package/dist/ts-compiler/sd-ts-compiler.js.map +1 -1
  57. package/dist/utils/sd-cli-performance-time.d.ts +2 -3
  58. package/dist/utils/sd-cli-performance-time.js +9 -9
  59. package/dist/utils/sd-cli-performance-time.js.map +1 -1
  60. package/package.json +8 -8
  61. package/src/entry/sd-cli-cordova.ts +92 -92
  62. package/src/entry/sd-cli-electron.ts +21 -21
  63. package/src/entry/sd-cli-local-update.ts +3 -3
  64. package/src/entry/sd-cli-project.ts +11 -11
  65. package/src/fix/convert-private-to-hash.ts +72 -0
  66. package/src/pkg-builders/client/sd-client.build-runner.ts +11 -11
  67. package/src/pkg-builders/client/sd-ng.bundler-context.ts +12 -12
  68. package/src/pkg-builders/client/sd-ng.bundler.ts +75 -75
  69. package/src/pkg-builders/commons/scope-path.ts +4 -4
  70. package/src/pkg-builders/lib/sd-cli-index.file-generator.ts +2 -2
  71. package/src/pkg-builders/lib/sd-js-lib.build-runner.ts +2 -2
  72. package/src/pkg-builders/lib/sd-ts-lib.build-runner.ts +3 -3
  73. package/src/pkg-builders/lib/sd-ts-lib.builder.ts +4 -4
  74. package/src/pkg-builders/sd-multi.build-runner.ts +27 -27
  75. package/src/pkg-builders/server/sd-server.build-runner.ts +11 -11
  76. package/src/pkg-builders/server/sd-server.bundler.ts +20 -20
  77. package/src/sd-cli-entry.ts +19 -8
  78. package/src/ts-compiler/sd-dependency-cache.ts +37 -37
  79. package/src/ts-compiler/sd-ts-compiler.ts +117 -117
  80. package/src/utils/sd-cli-performance-time.ts +10 -10
  81. package/dist/fix/convert-ecma-private-to-ts-private.d.ts +0 -1
  82. package/dist/fix/convert-ecma-private-to-ts-private.js +0 -59
  83. package/dist/fix/convert-ecma-private-to-ts-private.js.map +0 -1
  84. package/dist/fix/prefix-underscore-for-access-modifiers.d.ts +0 -1
  85. package/dist/fix/prefix-underscore-for-access-modifiers.js +0 -52
  86. package/dist/fix/prefix-underscore-for-access-modifiers.js.map +0 -1
  87. package/src/fix/convert-ecma-private-to-ts-private.ts +0 -71
  88. package/src/fix/prefix-underscore-for-access-modifiers.ts +0 -68
@@ -0,0 +1,72 @@
1
+ /* eslint-disable no-console */
2
+
3
+ import { Node, SyntaxKind } from "ts-morph";
4
+ import getTsMortphSourceFiles from "./core/get-ts-morph-source-files";
5
+
6
+ export default function convertPrivateToHash() {
7
+ const sourceFiles = getTsMortphSourceFiles();
8
+
9
+ for (const sourceFile of sourceFiles) {
10
+ let changed = false;
11
+
12
+ for (const classDecl of sourceFile.getClasses()) {
13
+ const renameMap = new Map<string, string>();
14
+
15
+ // 1. 선언부에서 private을 #으로 바꾸고 이름 매핑 저장
16
+ for (const member of classDecl.getMembers()) {
17
+ if (
18
+ Node.isPropertyDeclaration(member) ||
19
+ Node.isMethodDeclaration(member) ||
20
+ Node.isGetAccessorDeclaration(member) ||
21
+ Node.isSetAccessorDeclaration(member)
22
+ ) {
23
+ if (member.hasModifier(SyntaxKind.PrivateKeyword)) {
24
+ const nameNode = member.getNameNode();
25
+ if (typeof nameNode.getText !== "function") continue;
26
+
27
+ const oldName = nameNode.getText();
28
+ const newName = oldName.startsWith("_") ? `#${oldName.slice(1)}` : `#${oldName}`;
29
+
30
+ nameNode.replaceWithText(newName);
31
+ member.toggleModifier("private", false);
32
+ renameMap.set(oldName, newName);
33
+
34
+ const kind = Node.isMethodDeclaration(member)
35
+ ? "method"
36
+ : Node.isGetAccessorDeclaration(member) || Node.isSetAccessorDeclaration(member)
37
+ ? "accessor"
38
+ : "field";
39
+
40
+ console.log(`[private-${kind}] ${sourceFile.getBaseName()} :: private ${oldName} → ${newName}`);
41
+ changed = true;
42
+ }
43
+ }
44
+ }
45
+
46
+ if (renameMap.size === 0) continue;
47
+
48
+ // 2. this.xxx 접근 표현식 전환
49
+ classDecl.forEachDescendant((node) => {
50
+ const propAccess = node.asKind(SyntaxKind.PropertyAccessExpression);
51
+ if (propAccess) {
52
+ const expr = propAccess.getExpression();
53
+ const name = propAccess.getName();
54
+
55
+ if (expr.getText() === "this" && renameMap.has(name)) {
56
+ const newName = renameMap.get(name)!;
57
+ propAccess.replaceWithText(`this.${newName}`);
58
+ console.log(`[ref] ${sourceFile.getBaseName()} :: this.${name} → this.${newName}`);
59
+ changed = true;
60
+ }
61
+ }
62
+ });
63
+ }
64
+
65
+ if (changed) {
66
+ sourceFile.saveSync();
67
+ console.log(`[save] ${sourceFile.getFilePath()}`);
68
+ }
69
+ }
70
+
71
+ console.log("[완료] private → ECMAScript # 멤버 변환 완료");
72
+ }
@@ -10,8 +10,8 @@ import { INpmConfig } from "../../types/common-configs.types";
10
10
  export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
11
11
  protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdClientBuildRunner"]);
12
12
 
13
- private _ngBundlers?: SdNgBundler[];
14
- private _cordova?: SdCliCordova;
13
+ #ngBundlers?: SdNgBundler[];
14
+ #cordova?: SdCliCordova;
15
15
 
16
16
  protected override async _runAsync(
17
17
  dev: boolean,
@@ -36,7 +36,7 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
36
36
  }
37
37
  }
38
38
  else {
39
- for (const ngBundler of this._ngBundlers!) {
39
+ for (const ngBundler of this.#ngBundlers!) {
40
40
  ngBundler.markForChanges(Array.from(modifiedFileSet));
41
41
  }
42
42
  }
@@ -46,19 +46,19 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
46
46
  | "electron"
47
47
  | "cordova"
48
48
  )[];
49
- if (this._pkgConf.builder?.cordova && !this._cordova) {
49
+ if (this._pkgConf.builder?.cordova && !this.#cordova) {
50
50
  this._debug("CORDOVA 준비...");
51
- this._cordova = new SdCliCordova({
51
+ this.#cordova = new SdCliCordova({
52
52
  pkgPath: this._pkgPath,
53
53
  config: this._pkgConf.builder.cordova,
54
54
  });
55
- await this._cordova.initializeAsync();
55
+ await this.#cordova.initializeAsync();
56
56
  }
57
57
 
58
- if (!this._ngBundlers) {
58
+ if (!this.#ngBundlers) {
59
59
  this._debug(`BUILD 준비...`);
60
60
 
61
- this._ngBundlers = ngBundlerBuilderTypes.map(
61
+ this.#ngBundlers = ngBundlerBuilderTypes.map(
62
62
  (ngBundlerBuilderType) =>
63
63
  new SdNgBundler({
64
64
  dev,
@@ -89,15 +89,15 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
89
89
  }
90
90
 
91
91
  this._debug(`BUILD...`);
92
- const buildResults = await Promise.all(this._ngBundlers.map((builder) => builder.bundleAsync()));
92
+ const buildResults = await Promise.all(this.#ngBundlers.map((builder) => builder.bundleAsync()));
93
93
  const watchFileSet = new Set(buildResults.mapMany((item) => Array.from(item.watchFileSet)));
94
94
  const affectedFileSet = new Set(buildResults.mapMany((item) => Array.from(item.affectedFileSet)));
95
95
  const emitFileSet = new Set(buildResults.mapMany((item) => Array.from(item.emitFileSet)));
96
96
  const results = buildResults.mapMany((item) => item.results).distinct();
97
97
 
98
- if (!dev && this._cordova) {
98
+ if (!dev && this.#cordova) {
99
99
  this._debug("CORDOVA BUILD...");
100
- await this._cordova.buildAsync(path.resolve(this._pkgPath, "dist"));
100
+ await this.#cordova.buildAsync(path.resolve(this._pkgPath, "dist"));
101
101
  }
102
102
 
103
103
  if (!dev && this._pkgConf.builder?.electron) {
@@ -15,27 +15,27 @@ interface InitialFileRecord {
15
15
  }
16
16
 
17
17
  export class SdNgBundlerContext {
18
- private _logger = SdLogger.get(["simplysm", "sd-cli", "SdNgBundlerContext"]);
18
+ #logger = SdLogger.get(["simplysm", "sd-cli", "SdNgBundlerContext"]);
19
19
 
20
- private _context?: esbuild.BuildContext;
20
+ #context?: esbuild.BuildContext;
21
21
 
22
22
  constructor(
23
- private _pkgPath: string,
24
- private _esbuildOptions: esbuild.BuildOptions,
23
+ private readonly _pkgPath: string,
24
+ private readonly _esbuildOptions: esbuild.BuildOptions,
25
25
  ) {
26
26
  }
27
27
 
28
28
  async bundleAsync() {
29
- if (this._context == null) {
30
- this._context = await esbuild.context(this._esbuildOptions);
29
+ if (this.#context == null) {
30
+ this.#context = await esbuild.context(this._esbuildOptions);
31
31
  }
32
32
 
33
33
  let esbuildResult: esbuild.BuildResult;
34
34
 
35
35
  try {
36
- this._debug(`rebuild...`);
37
- esbuildResult = await this._context.rebuild();
38
- this._debug(`rebuild completed`);
36
+ this.#debug(`rebuild...`);
37
+ esbuildResult = await this.#context.rebuild();
38
+ this.#debug(`rebuild completed`);
39
39
  }
40
40
  catch (err) {
41
41
  if ("warnings" in err || "errors" in err) {
@@ -46,7 +46,7 @@ export class SdNgBundlerContext {
46
46
  }
47
47
  }
48
48
 
49
- this._debug(`convert results...`);
49
+ this.#debug(`convert results...`);
50
50
 
51
51
  const results = SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(
52
52
  esbuildResult,
@@ -118,8 +118,8 @@ export class SdNgBundlerContext {
118
118
  };
119
119
  }
120
120
 
121
- private _debug(...msg: any[]): void {
122
- this._logger.debug(
121
+ #debug(...msg: any[]): void {
122
+ this.#logger.debug(
123
123
  `[${path.basename(this._pkgPath)}] (${Object.keys(this._esbuildOptions.entryPoints as Record<string, any>)
124
124
  .join(", ")})`,
125
125
  ...msg,
@@ -48,30 +48,30 @@ import nodeModule from "module";
48
48
  import { ScopePathSet } from "../commons/scope-path";
49
49
 
50
50
  export class SdNgBundler {
51
- private _logger = SdLogger.get(["simplysm", "sd-cli", "SdNgBundler"]);
51
+ #logger = SdLogger.get(["simplysm", "sd-cli", "SdNgBundler"]);
52
52
 
53
- private _modifiedFileSet = new Set<TNormPath>();
54
- private _ngResultCache: ISdCliNgPluginResultCache = {
53
+ #modifiedFileSet = new Set<TNormPath>();
54
+ #ngResultCache: ISdCliNgPluginResultCache = {
55
55
  affectedFileSet: new Set<TNormPath>(),
56
56
  watchFileSet: new Set<TNormPath>(),
57
57
  };
58
- private _styleLoadResultCache = new MemoryLoadResultCache();
58
+ #styleLoadResultCache = new MemoryLoadResultCache();
59
59
 
60
- private _contexts: SdNgBundlerContext[] | undefined;
60
+ #contexts: SdNgBundlerContext[] | undefined;
61
61
 
62
- private _outputHashCache = new Map<TNormPath, string>();
62
+ #outputHashCache = new Map<TNormPath, string>();
63
63
 
64
- private _pkgNpmConf: INpmConfig;
65
- private _mainFilePath: string;
66
- private _tsConfigFilePath: string;
67
- private _swConfFilePath: string;
68
- private _browserTarget: string[];
69
- private _indexHtmlFilePath: string;
70
- private _pkgName: string;
71
- private _baseHref: string;
64
+ #pkgNpmConf: INpmConfig;
65
+ #mainFilePath: string;
66
+ #tsConfigFilePath: string;
67
+ #swConfFilePath: string;
68
+ #browserTarget: string[];
69
+ #indexHtmlFilePath: string;
70
+ #pkgName: string;
71
+ #baseHref: string;
72
72
 
73
73
  constructor(
74
- private _opt: {
74
+ private readonly _opt: {
75
75
  dev: boolean;
76
76
  outputPath: TNormPath;
77
77
  pkgPath: TNormPath;
@@ -82,25 +82,25 @@ export class SdNgBundler {
82
82
  watchScopePathSet: ScopePathSet;
83
83
  },
84
84
  ) {
85
- this._pkgNpmConf = FsUtils.readJson(path.resolve(this._opt.pkgPath, "package.json"));
86
- this._mainFilePath = path.resolve(this._opt.pkgPath, "src/main.ts");
87
- this._tsConfigFilePath = path.resolve(this._opt.pkgPath, "tsconfig.json");
88
- this._swConfFilePath = path.resolve(this._opt.pkgPath, "ngsw-config.json");
89
- this._browserTarget = transformSupportedBrowsersToTargets(browserslist(["Chrome > 78"]));
90
- this._indexHtmlFilePath = path.resolve(this._opt.pkgPath, "src/index.html");
91
- this._pkgName = path.basename(this._opt.pkgPath);
92
- this._baseHref =
85
+ this.#pkgNpmConf = FsUtils.readJson(path.resolve(this._opt.pkgPath, "package.json"));
86
+ this.#mainFilePath = path.resolve(this._opt.pkgPath, "src/main.ts");
87
+ this.#tsConfigFilePath = path.resolve(this._opt.pkgPath, "tsconfig.json");
88
+ this.#swConfFilePath = path.resolve(this._opt.pkgPath, "ngsw-config.json");
89
+ this.#browserTarget = transformSupportedBrowsersToTargets(browserslist(["Chrome > 78"]));
90
+ this.#indexHtmlFilePath = path.resolve(this._opt.pkgPath, "src/index.html");
91
+ this.#pkgName = path.basename(this._opt.pkgPath);
92
+ this.#baseHref =
93
93
  this._opt.builderType === "web"
94
- ? `/${this._pkgName}/`
94
+ ? `/${this.#pkgName}/`
95
95
  : this._opt.dev
96
- ? `/${this._pkgName}/${this._opt.builderType}/`
96
+ ? `/${this.#pkgName}/${this._opt.builderType}/`
97
97
  : ``;
98
98
  }
99
99
 
100
100
  markForChanges(filePaths: string[]): void {
101
101
  for (const filePath of filePaths) {
102
- this._modifiedFileSet.add(PathUtils.norm(filePath));
103
- this._styleLoadResultCache.invalidate(PathUtils.norm(filePath));
102
+ this.#modifiedFileSet.add(PathUtils.norm(filePath));
103
+ this.#styleLoadResultCache.invalidate(PathUtils.norm(filePath));
104
104
  }
105
105
  // this._sourceFileCache.invalidate(filePaths);
106
106
  }
@@ -113,28 +113,28 @@ export class SdNgBundler {
113
113
  }> {
114
114
  const perf = new SdCliPerformanceTimer("ng bundle");
115
115
 
116
- this._debug(`get contexts...`);
116
+ this.#debug(`get contexts...`);
117
117
 
118
- if (!this._contexts) {
119
- this._contexts = perf.run("get contexts", () => [
120
- this._getAppContext(),
118
+ if (!this.#contexts) {
119
+ this.#contexts = perf.run("get contexts", () => [
120
+ this.#getAppContext(),
121
121
  ...FsUtils.exists(path.resolve(this._opt.pkgPath, "src/styles.scss")) ? [
122
- this._getStyleContext(),
122
+ this.#getStyleContext(),
123
123
  ] : [],
124
- ...(this._opt.builderType === "electron" ? [this._getElectronMainContext()] : []),
124
+ ...(this._opt.builderType === "electron" ? [this.#getElectronMainContext()] : []),
125
125
  ]);
126
126
  }
127
127
 
128
- this._debug(`build...`);
128
+ this.#debug(`build...`);
129
129
 
130
130
  const bundlingResults = await perf.run("build", async () => {
131
- return await this._contexts!.mapAsync(async (ctx) => await ctx.bundleAsync());
131
+ return await this.#contexts!.mapAsync(async (ctx) => await ctx.bundleAsync());
132
132
  });
133
133
 
134
134
  //-- results
135
135
  const results = bundlingResults.mapMany((bundlingResult) => bundlingResult.results);
136
136
 
137
- this._debug(`convert result...`);
137
+ this.#debug(`convert result...`);
138
138
 
139
139
  const outputFiles: BuildOutputFile[] = bundlingResults.mapMany(
140
140
  (item) => item.outputFiles?.map((file) => convertOutputFile(file, BuildOutputFileType.Root))
@@ -160,9 +160,9 @@ export class SdNgBundler {
160
160
  outputFiles.push(createOutputFile("cordova-empty.js", "export default {};", BuildOutputFileType.Root));
161
161
  }*/
162
162
 
163
- this._debug(`create index.html...`);
163
+ this.#debug(`create index.html...`);
164
164
  await perf.run("create index.html", async () => {
165
- const genIndexHtmlResult = await this._genIndexHtmlAsync(outputFiles, initialFiles);
165
+ const genIndexHtmlResult = await this.#genIndexHtmlAsync(outputFiles, initialFiles);
166
166
  for (const warning of genIndexHtmlResult.warnings) {
167
167
  results.push({
168
168
  filePath: undefined,
@@ -194,7 +194,7 @@ export class SdNgBundler {
194
194
 
195
195
  await perf.run("assets", async () => {
196
196
  //-- copy assets
197
- assetFiles.push(...(await this._copyAssetsAsync()));
197
+ assetFiles.push(...(await this.#copyAssetsAsync()));
198
198
 
199
199
  //-- extract 3rdpartylicenses
200
200
  if (!this._opt.dev) {
@@ -209,12 +209,12 @@ export class SdNgBundler {
209
209
  });
210
210
 
211
211
  //-- service worker
212
- if (FsUtils.exists(this._swConfFilePath)) {
213
- this._debug(`prepare service worker...`);
212
+ if (FsUtils.exists(this.#swConfFilePath)) {
213
+ this.#debug(`prepare service worker...`);
214
214
 
215
215
  await perf.run("prepare service worker", async () => {
216
216
  try {
217
- const serviceWorkerResult = await this._genServiceWorkerAsync(outputFiles, assetFiles);
217
+ const serviceWorkerResult = await this.#genServiceWorkerAsync(outputFiles, assetFiles);
218
218
  outputFiles.push(createOutputFile(
219
219
  "ngsw.json",
220
220
  serviceWorkerResult.manifest,
@@ -237,47 +237,47 @@ export class SdNgBundler {
237
237
  }
238
238
 
239
239
  //-- write
240
- this._debug(`write output files...(${outputFiles.length})`);
240
+ this.#debug(`write output files...(${outputFiles.length})`);
241
241
 
242
242
  const emitFileSet = new Set<TNormPath>();
243
243
  perf.run("write output file", () => {
244
244
  for (const outputFile of outputFiles) {
245
245
  const distFilePath = PathUtils.norm(this._opt.outputPath, outputFile.path);
246
- const prevHash = this._outputHashCache.get(distFilePath);
246
+ const prevHash = this.#outputHashCache.get(distFilePath);
247
247
  const currHash = HashUtils.get(Buffer.from(outputFile.contents));
248
248
  if (prevHash !== currHash) {
249
249
  FsUtils.writeFile(distFilePath, outputFile.contents);
250
- this._outputHashCache.set(distFilePath, currHash);
250
+ this.#outputHashCache.set(distFilePath, currHash);
251
251
  emitFileSet.add(PathUtils.norm(outputFile.path));
252
252
  }
253
253
  }
254
254
  for (const assetFile of assetFiles) {
255
- const prevHash = this._outputHashCache.get(PathUtils.norm(assetFile.source));
255
+ const prevHash = this.#outputHashCache.get(PathUtils.norm(assetFile.source));
256
256
  const currHash = FsUtils.hash(assetFile.source);
257
257
  if (prevHash !== currHash) {
258
258
  FsUtils.copy(assetFile.source, path.resolve(this._opt.outputPath, assetFile.destination));
259
- this._outputHashCache.set(PathUtils.norm(assetFile.source), currHash);
259
+ this.#outputHashCache.set(PathUtils.norm(assetFile.source), currHash);
260
260
  emitFileSet.add(PathUtils.norm(assetFile.destination));
261
261
  }
262
262
  }
263
263
  });
264
264
 
265
- this._debug(perf.toString());
265
+ this.#debug(perf.toString());
266
266
 
267
267
  return {
268
268
  watchFileSet: new Set([
269
- ...this._ngResultCache.watchFileSet!,
270
- ...this._styleLoadResultCache.watchFiles.map((item) => PathUtils.norm(item)),
269
+ ...this.#ngResultCache.watchFileSet!,
270
+ ...this.#styleLoadResultCache.watchFiles.map((item) => PathUtils.norm(item)),
271
271
  ...assetFiles.map((item) => PathUtils.norm(item.source)),
272
- PathUtils.norm(this._indexHtmlFilePath),
272
+ PathUtils.norm(this.#indexHtmlFilePath),
273
273
  ]),
274
- affectedFileSet: this._ngResultCache.affectedFileSet!,
274
+ affectedFileSet: this.#ngResultCache.affectedFileSet!,
275
275
  results,
276
276
  emitFileSet: emitFileSet,
277
277
  };
278
278
  }
279
279
 
280
- private async _genIndexHtmlAsync(
280
+ async #genIndexHtmlAsync(
281
281
  outputFiles: esbuild.OutputFile[],
282
282
  initialFiles: Map<string, InitialFileRecord>,
283
283
  ): Promise<IndexHtmlProcessResult> {
@@ -292,7 +292,7 @@ export class SdNgBundler {
292
292
  };
293
293
 
294
294
  const indexHtmlGenerator = new IndexHtmlGenerator({
295
- indexPath: this._indexHtmlFilePath,
295
+ indexPath: this.#indexHtmlFilePath,
296
296
  entrypoints: [
297
297
  ["polyfills", true],
298
298
  ["styles", false],
@@ -337,7 +337,7 @@ export class SdNgBundler {
337
337
  }
338
338
 
339
339
  return await indexHtmlGenerator.process({
340
- baseHref: this._baseHref,
340
+ baseHref: this.#baseHref,
341
341
  lang: undefined,
342
342
  outputPath: "/",
343
343
  files: [...initialFiles].map(([file, record]) => ({
@@ -349,7 +349,7 @@ export class SdNgBundler {
349
349
  });
350
350
  }
351
351
 
352
- private async _copyAssetsAsync(): Promise<
352
+ async #copyAssetsAsync(): Promise<
353
353
  {
354
354
  source: string;
355
355
  destination: string;
@@ -389,7 +389,7 @@ export class SdNgBundler {
389
389
  );
390
390
  }
391
391
 
392
- private async _genServiceWorkerAsync(
392
+ async #genServiceWorkerAsync(
393
393
  outputFiles: BuildOutputFile[],
394
394
  assetFiles: {
395
395
  source: string;
@@ -404,15 +404,15 @@ export class SdNgBundler {
404
404
  }> {
405
405
  return await augmentAppWithServiceWorkerEsbuild(
406
406
  this._opt.pkgPath,
407
- this._swConfFilePath,
408
- this._baseHref,
407
+ this.#swConfFilePath,
408
+ this.#baseHref,
409
409
  "index.html",
410
410
  outputFiles,
411
411
  assetFiles,
412
412
  );
413
413
  }
414
414
 
415
- private _getAppContext() {
415
+ #getAppContext() {
416
416
  const workerEntries = FsUtils.glob(path.resolve(this._opt.pkgPath, "src/workers/*.ts"))
417
417
  .toObject(
418
418
  (p) => "workers/" + path.basename(p, path.extname(p)),
@@ -436,7 +436,7 @@ export class SdNgBundler {
436
436
  outExtension: undefined,
437
437
  sourcemap: this._opt.dev,
438
438
  chunkNames: "[name]-[hash]",
439
- tsconfig: this._tsConfigFilePath,
439
+ tsconfig: this.#tsConfigFilePath,
440
440
  write: false,
441
441
  preserveSymlinks: false,
442
442
  define: {
@@ -445,7 +445,7 @@ export class SdNgBundler {
445
445
  "global": "global",
446
446
  "process": "process",
447
447
  "Buffer": "Buffer",
448
- "process.env.SD_VERSION": JSON.stringify(this._pkgNpmConf.version),
448
+ "process.env.SD_VERSION": JSON.stringify(this.#pkgNpmConf.version),
449
449
  "process.env.NODE_ENV": JSON.stringify(this._opt.dev ? "development" : "production"),
450
450
  ...(this._opt.env
451
451
  ? Object.keys(this._opt.env).toObject(
@@ -457,7 +457,7 @@ export class SdNgBundler {
457
457
  mainFields: ["es2020", "es2015", "browser", "module", "main"],
458
458
  entryNames: "[dir]/[name]",
459
459
  entryPoints: {
460
- main: this._mainFilePath,
460
+ main: this.#mainFilePath,
461
461
  ...FsUtils.exists(path.resolve(this._opt.pkgPath, "src/polyfills.ts")) ? {
462
462
  polyfills: path.resolve(this._opt.pkgPath, "src/polyfills.ts"),
463
463
  } : {},
@@ -508,7 +508,7 @@ export class SdNgBundler {
508
508
  }
509
509
  : {
510
510
  platform: "browser",
511
- target: this._browserTarget,
511
+ target: this.#browserTarget,
512
512
  format: "esm",
513
513
  splitting: true,
514
514
  inject: [
@@ -519,10 +519,10 @@ export class SdNgBundler {
519
519
  plugins: [
520
520
  createSourcemapIgnorelistPlugin(),
521
521
  createSdNgPlugin({
522
- modifiedFileSet: this._modifiedFileSet,
522
+ modifiedFileSet: this.#modifiedFileSet,
523
523
  dev: this._opt.dev,
524
524
  pkgPath: this._opt.pkgPath,
525
- result: this._ngResultCache,
525
+ result: this.#ngResultCache,
526
526
  watchScopePathSet: this._opt.watchScopePathSet,
527
527
  }),
528
528
  ...(this._opt.builderType === "electron"
@@ -543,13 +543,13 @@ export class SdNgBundler {
543
543
  });
544
544
  }
545
545
 
546
- private _getStyleContext(): SdNgBundlerContext {
546
+ #getStyleContext(): SdNgBundlerContext {
547
547
  const pluginFactory = new StylesheetPluginFactory(
548
548
  {
549
549
  sourcemap: this._opt.dev,
550
550
  includePaths: [],
551
551
  },
552
- this._styleLoadResultCache,
552
+ this.#styleLoadResultCache,
553
553
  );
554
554
 
555
555
  return new SdNgBundlerContext(this._opt.pkgPath, {
@@ -564,7 +564,7 @@ export class SdNgBundler {
564
564
  outdir: this._opt.pkgPath,
565
565
  write: false,
566
566
  platform: "browser",
567
- target: this._browserTarget,
567
+ target: this.#browserTarget,
568
568
  preserveSymlinks: false,
569
569
  external: [],
570
570
  conditions: ["style", "sass"],
@@ -576,12 +576,12 @@ export class SdNgBundler {
576
576
  plugins: [
577
577
  pluginFactory.create(SassStylesheetLanguage),
578
578
  pluginFactory.create(CssStylesheetLanguage),
579
- createCssResourcePlugin(this._styleLoadResultCache),
579
+ createCssResourcePlugin(this.#styleLoadResultCache),
580
580
  ],
581
581
  });
582
582
  }
583
583
 
584
- private _getElectronMainContext() {
584
+ #getElectronMainContext() {
585
585
  return new SdNgBundlerContext(this._opt.pkgPath, {
586
586
  absWorkingDir: this._opt.pkgPath,
587
587
  bundle: true,
@@ -595,13 +595,13 @@ export class SdNgBundler {
595
595
  minify: !this._opt.dev,
596
596
  outdir: this._opt.pkgPath,
597
597
  sourcemap: this._opt.dev,
598
- tsconfig: this._tsConfigFilePath,
598
+ tsconfig: this.#tsConfigFilePath,
599
599
  write: false,
600
600
  preserveSymlinks: false,
601
601
  external: ["electron"],
602
602
  define: {
603
603
  ...(!this._opt.dev ? { ngDevMode: "false" } : {}),
604
- "process.env.SD_VERSION": JSON.stringify(this._pkgNpmConf.version),
604
+ "process.env.SD_VERSION": JSON.stringify(this.#pkgNpmConf.version),
605
605
  "process.env.NODE_ENV": JSON.stringify(this._opt.dev ? "development" : "production"),
606
606
  ...(this._opt.env
607
607
  ? Object.keys(this._opt.env).toObject(
@@ -617,7 +617,7 @@ export class SdNgBundler {
617
617
  });
618
618
  }
619
619
 
620
- private _debug(...msg: any[]): void {
621
- this._logger.debug(`[${path.basename(this._opt.pkgPath)}]`, ...msg);
620
+ #debug(...msg: any[]): void {
621
+ this.#logger.debug(`[${path.basename(this._opt.pkgPath)}]`, ...msg);
622
622
  }
623
623
  }
@@ -1,17 +1,17 @@
1
1
  import { PathUtils, TNormPath } from "@simplysm/sd-core-node";
2
2
 
3
3
  export class ScopePathSet {
4
- private _data: Set<TNormPath>;
4
+ #data: Set<TNormPath>;
5
5
 
6
6
  constructor(arr?: TNormPath[]) {
7
- this._data = new Set(arr);
7
+ this.#data = new Set(arr);
8
8
  }
9
9
 
10
10
  inScope(filePath: string) {
11
- return Array.from(this._data).some((scope) => PathUtils.isChildPath(filePath, scope));
11
+ return Array.from(this.#data).some((scope) => PathUtils.isChildPath(filePath, scope));
12
12
  }
13
13
 
14
14
  toArray() {
15
- return Array.from(this._data);
15
+ return Array.from(this.#data);
16
16
  }
17
17
  }
@@ -26,7 +26,7 @@ export class SdCliIndexFileGenerator {
26
26
  }
27
27
 
28
28
  // 내부 파일들 import
29
- const filePaths = this._getFilePaths(pkgPath);
29
+ const filePaths = this.#getFilePaths(pkgPath);
30
30
  for (const filePath of filePaths.orderBy()) {
31
31
  const requirePath = PathUtils.posix(path.relative(path.dirname(indexFilePath), filePath))
32
32
  .replace(/\.tsx?$/, "")
@@ -47,7 +47,7 @@ export class SdCliIndexFileGenerator {
47
47
  return content;
48
48
  }
49
49
 
50
- private static _getFilePaths(pkgPath: string): string[] {
50
+ static #getFilePaths(pkgPath: string): string[] {
51
51
  const indexFilePath = path.resolve(pkgPath, "src/index.ts");
52
52
 
53
53
  const tsconfig = FsUtils.readJson(path.resolve(pkgPath, "tsconfig.json"));
@@ -24,7 +24,7 @@ export class SdJsLibBuildRunner extends BuildRunnerBase<"library"> {
24
24
 
25
25
  this._debug("LINT...");
26
26
 
27
- const lintResults = await this._lintAsync(filePathSet);
27
+ const lintResults = await this.#lintAsync(filePathSet);
28
28
  const messages = SdCliConvertMessageUtils.convertToBuildMessagesFromEslint(lintResults);
29
29
 
30
30
  this._debug(`LINT 완료`);
@@ -45,7 +45,7 @@ export class SdJsLibBuildRunner extends BuildRunnerBase<"library"> {
45
45
  );
46
46
  }
47
47
 
48
- private async _lintAsync(fileSet: Set<string>) {
48
+ async #lintAsync(fileSet: Set<string>) {
49
49
  const lintFilePaths = Array.from(fileSet)
50
50
  .filter((item) => PathUtils.isChildPath(item, path.resolve(this._pkgPath, "src")))
51
51
  .filter((item) => item.endsWith(".js"))
@@ -7,7 +7,7 @@ import { SdCliDbContextFileGenerator } from "./sd-cli-db-context.file-generator"
7
7
  export class SdTsLibBuildRunner extends BuildRunnerBase<"library"> {
8
8
  protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdCliTsLibBuilder"]);
9
9
 
10
- private _builder?: SdTsLibBuilder;
10
+ #builder?: SdTsLibBuilder;
11
11
 
12
12
  protected override async _runAsync(
13
13
  dev: boolean,
@@ -39,12 +39,12 @@ export class SdTsLibBuildRunner extends BuildRunnerBase<"library"> {
39
39
  }
40
40
 
41
41
  this._debug(`BUILD...`);
42
- this._builder ??= new SdTsLibBuilder(
42
+ this.#builder ??= new SdTsLibBuilder(
43
43
  PathUtils.norm(this._pkgPath),
44
44
  dev,
45
45
  this._watchScopePathSet,
46
46
  );
47
- const buildResult = await this._builder.buildAsync(modifiedFileSet ?? new Set());
47
+ const buildResult = await this.#builder.buildAsync(modifiedFileSet ?? new Set());
48
48
 
49
49
  this._debug(`빌드 완료`);
50
50
  const watchFileSet = new Set(