@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
@@ -6,14 +6,14 @@ import { SdTsCompiler } from "../../ts-compiler/sd-ts-compiler";
6
6
  import { ScopePathSet } from "../commons/scope-path";
7
7
 
8
8
  export class SdTsLibBuilder {
9
- private _tsCompiler: SdTsCompiler;
9
+ #tsCompiler: SdTsCompiler;
10
10
 
11
11
  constructor(
12
- private _pkgPath: TNormPath,
12
+ private readonly _pkgPath: TNormPath,
13
13
  dev: boolean,
14
14
  watchScopePathSet: ScopePathSet,
15
15
  ) {
16
- this._tsCompiler = new SdTsCompiler({
16
+ this.#tsCompiler = new SdTsCompiler({
17
17
  pkgPath: this._pkgPath,
18
18
  additionalOptions: { declaration: true },
19
19
  isDevMode: dev,
@@ -29,7 +29,7 @@ export class SdTsLibBuilder {
29
29
  results: ISdBuildMessage[];
30
30
  emitFileSet: Set<TNormPath>;
31
31
  }> {
32
- const tsCompileResult = await this._tsCompiler.compileAsync(modifiedFileSet);
32
+ const tsCompileResult = await this.#tsCompiler.compileAsync(modifiedFileSet);
33
33
 
34
34
  const emitFileSet = new Set<TNormPath>();
35
35
  for (const emitFile of tsCompileResult.emitFileSet) {
@@ -8,12 +8,12 @@ import { INpmConfig } from "../types/common-configs.types";
8
8
  import { ISdBuildRunnerWorkerRequest } from "../types/build-runner.types";
9
9
 
10
10
  export class SdMultiBuildRunner extends EventEmitter {
11
- private _logger = SdLogger.get(["simplysm", "sd-cli", "SdMultiBuildRunner"]);
11
+ #logger = SdLogger.get(["simplysm", "sd-cli", "SdMultiBuildRunner"]);
12
12
 
13
- private _busyCount = 0;
13
+ #busyCount = 0;
14
14
 
15
- private _resultCache = new Map<TNormPath, ISdBuildMessage[]>();
16
- private _serverInfoMap = new Map<
15
+ #resultCache = new Map<TNormPath, ISdBuildMessage[]>();
16
+ #serverInfoMap = new Map<
17
17
  string,
18
18
  {
19
19
  pkgInfo?: { path: string; conf: ISdServerPackageConfig } | { port: number }; // persist
@@ -46,12 +46,12 @@ export class SdMultiBuildRunner extends EventEmitter {
46
46
  const worker = new SdWorker<TSdBuildRunnerWorkerType>(import.meta.resolve(
47
47
  "../workers/build-runner.worker"))
48
48
  .on("change", () => {
49
- if (this._busyCount === 0) {
49
+ if (this.#busyCount === 0) {
50
50
  this.emit("change");
51
51
  }
52
- this._busyCount++;
52
+ this.#busyCount++;
53
53
  })
54
- .on("complete", (result) => this._onComplete(req, result));
54
+ .on("complete", (result) => this.#onComplete(req, result));
55
55
 
56
56
  return await worker.run("run", [req]);
57
57
  /*const pkgConf = req.projConf.packages[path.basename(req.pkgPath)]!;
@@ -78,16 +78,16 @@ export class SdMultiBuildRunner extends EventEmitter {
78
78
  }*/
79
79
  }
80
80
 
81
- private _onComplete(req: ISdBuildRunnerWorkerRequest, result: ISdBuildRunnerResult) {
82
- this._resultCache.delete(req.pkgPath);
81
+ #onComplete(req: ISdBuildRunnerWorkerRequest, result: ISdBuildRunnerResult) {
82
+ this.#resultCache.delete(req.pkgPath);
83
83
  for (const affectedFilePath of result.affectedFilePathSet) {
84
84
  if (PathUtils.isChildPath(affectedFilePath, req.pkgPath)) {
85
- this._resultCache.delete(affectedFilePath);
85
+ this.#resultCache.delete(affectedFilePath);
86
86
  }
87
87
  }
88
88
 
89
89
  for (const buildMessage of result.buildMessages) {
90
- const cacheItem = this._resultCache.getOrCreate(buildMessage.filePath ?? req.pkgPath, []);
90
+ const cacheItem = this.#resultCache.getOrCreate(buildMessage.filePath ?? req.pkgPath, []);
91
91
  cacheItem.push(buildMessage);
92
92
  }
93
93
 
@@ -95,7 +95,7 @@ export class SdMultiBuildRunner extends EventEmitter {
95
95
 
96
96
  if (pkgConf.type === "server") {
97
97
  const pkgName = path.basename(req.pkgPath);
98
- const serverInfo = this._serverInfoMap.getOrCreate(pkgName, {
98
+ const serverInfo = this.#serverInfoMap.getOrCreate(pkgName, {
99
99
  hasChanges: true,
100
100
  clientChangedFileSet: new Set(),
101
101
  clients: {},
@@ -113,7 +113,7 @@ export class SdMultiBuildRunner extends EventEmitter {
113
113
  const pkgName = path.basename(req.pkgPath);
114
114
 
115
115
  if (pkgConf.server !== undefined) {
116
- const serverInfo = this._serverInfoMap.getOrCreate(
116
+ const serverInfo = this.#serverInfoMap.getOrCreate(
117
117
  typeof pkgConf.server === "string" ? pkgConf.server : pkgConf.server.port.toString(),
118
118
  {
119
119
  hasChanges: true,
@@ -134,7 +134,7 @@ export class SdMultiBuildRunner extends EventEmitter {
134
134
  serverInfo.clientChangedFileSet.adds(...result.emitFileSet);
135
135
  }
136
136
  else {
137
- const serverInfo = this._serverInfoMap.getOrCreate(pkgName, {
137
+ const serverInfo = this.#serverInfoMap.getOrCreate(pkgName, {
138
138
  hasChanges: true,
139
139
  clientChangedFileSet: new Set(),
140
140
  clients: {},
@@ -145,14 +145,14 @@ export class SdMultiBuildRunner extends EventEmitter {
145
145
  }
146
146
 
147
147
  setTimeout(async () => {
148
- this._busyCount--;
149
- if (this._busyCount === 0) {
150
- for (const serverPkgNameOrPort of this._serverInfoMap.keys()) {
151
- const serverInfo = this._serverInfoMap.get(serverPkgNameOrPort)!;
148
+ this.#busyCount--;
149
+ if (this.#busyCount === 0) {
150
+ for (const serverPkgNameOrPort of this.#serverInfoMap.keys()) {
151
+ const serverInfo = this.#serverInfoMap.get(serverPkgNameOrPort)!;
152
152
  if (serverInfo.pkgInfo && serverInfo.hasChanges) {
153
- this._logger.debug("서버 재시작...");
153
+ this.#logger.debug("서버 재시작...");
154
154
  try {
155
- const restartServerResult = await this._restartServerAsync(
155
+ const restartServerResult = await this.#restartServerAsync(
156
156
  serverInfo.pkgInfo,
157
157
  serverInfo.worker,
158
158
  );
@@ -161,12 +161,12 @@ export class SdMultiBuildRunner extends EventEmitter {
161
161
  serverInfo.hasChanges = false;
162
162
  }
163
163
  catch (err) {
164
- this._logger.error(err);
164
+ this.#logger.error(err);
165
165
  }
166
166
  }
167
167
 
168
168
  if (serverInfo.worker) {
169
- this._logger.debug("클라이언트 설정...");
169
+ this.#logger.debug("클라이언트 설정...");
170
170
  await serverInfo.worker.run("setPathProxy", [
171
171
  {
172
172
  ...Object.keys(serverInfo.clients).toObject(
@@ -178,14 +178,14 @@ export class SdMultiBuildRunner extends EventEmitter {
178
178
  ]);
179
179
 
180
180
  if (serverInfo.clientChangedFileSet.size > 0) {
181
- this._logger.debug("클라이언트 새로고침...");
181
+ this.#logger.debug("클라이언트 새로고침...");
182
182
  await serverInfo.worker.run("broadcastReload", [serverInfo.clientChangedFileSet]);
183
183
  }
184
184
  }
185
185
  }
186
186
 
187
187
  const clientPaths: string[] = [];
188
- for (const serverInfo of this._serverInfoMap.values()) {
188
+ for (const serverInfo of this.#serverInfoMap.values()) {
189
189
  if (Object.keys(serverInfo.clients).length > 0) {
190
190
  for (const clientPkgName of Object.keys(serverInfo.clients)) {
191
191
  for (const buildType of serverInfo.clients[clientPkgName].buildTypes) {
@@ -203,16 +203,16 @@ export class SdMultiBuildRunner extends EventEmitter {
203
203
  }
204
204
  }
205
205
  if (clientPaths.length > 0) {
206
- this._logger.info("클라이언트 개발 서버 접속 주소\n" + clientPaths.join("\n"));
206
+ this.#logger.info("클라이언트 개발 서버 접속 주소\n" + clientPaths.join("\n"));
207
207
  }
208
208
 
209
- const messages = Array.from(this._resultCache.values()).mapMany();
209
+ const messages = Array.from(this.#resultCache.values()).mapMany();
210
210
  this.emit("complete", messages);
211
211
  }
212
212
  }, 300);
213
213
  }
214
214
 
215
- private async _restartServerAsync(
215
+ async #restartServerAsync(
216
216
  pkgInfo: { path: string; conf: ISdServerPackageConfig } | { port: number },
217
217
  prevWorker?: SdWorker<TServerWorkerType>,
218
218
  ): Promise<{
@@ -8,15 +8,15 @@ import { BuildRunnerBase, IBuildRunnerRunResult } from "../commons/build-runner.
8
8
  export class SdServerBuildRunner extends BuildRunnerBase<"server"> {
9
9
  protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdCliServerBuildRunner"]);
10
10
 
11
- private _serverBundler?: SdServerBundler;
12
- private _extModules?: { name: string; exists: boolean }[];
11
+ #serverBundler?: SdServerBundler;
12
+ #extModules?: { name: string; exists: boolean }[];
13
13
 
14
14
  protected override async _runAsync(
15
15
  dev: boolean,
16
16
  modifiedFileSet?: Set<TNormPath>,
17
17
  ): Promise<IBuildRunnerRunResult> {
18
18
  if (!dev) {
19
- await this._generateProductionFilesAsync();
19
+ await this.#generateProductionFilesAsync();
20
20
  }
21
21
 
22
22
  if (!modifiedFileSet) {
@@ -31,9 +31,9 @@ export class SdServerBuildRunner extends BuildRunnerBase<"server"> {
31
31
 
32
32
  this._debug(`BUILD 준비...`);
33
33
  const tsConfig = FsUtils.readJson(path.resolve(this._pkgPath, "tsconfig.json")) as ITsConfig;
34
- this._extModules = this._extModules ?? (await this._getExternalModulesAsync());
35
- this._serverBundler =
36
- this._serverBundler ??
34
+ this.#extModules = this.#extModules ?? (await this.#getExternalModulesAsync());
35
+ this.#serverBundler =
36
+ this.#serverBundler ??
37
37
  new SdServerBundler({
38
38
  dev,
39
39
  pkgPath: this._pkgPath,
@@ -43,12 +43,12 @@ export class SdServerBuildRunner extends BuildRunnerBase<"server"> {
43
43
  path.resolve(this._pkgPath, "src/main.ts"),
44
44
  ...FsUtils.glob(path.resolve(this._pkgPath, "src/workers/*.ts")),
45
45
  ],
46
- external: this._extModules.map((item) => item.name),
46
+ external: this.#extModules.map((item) => item.name),
47
47
  watchScopePathSet: this._watchScopePathSet,
48
48
  });
49
49
 
50
50
  this._debug(`BUILD...`);
51
- const bundleResult = await this._serverBundler.bundleAsync(modifiedFileSet);
51
+ const bundleResult = await this.#serverBundler.bundleAsync(modifiedFileSet);
52
52
 
53
53
  //-- filePaths
54
54
  const watchFileSet = new Set(
@@ -64,7 +64,7 @@ export class SdServerBuildRunner extends BuildRunnerBase<"server"> {
64
64
  };
65
65
  }
66
66
 
67
- private async _generateProductionFilesAsync() {
67
+ async #generateProductionFilesAsync() {
68
68
  const npmConf = FsUtils.readJson(path.resolve(this._pkgPath, "package.json")) as INpmConfig;
69
69
 
70
70
  this._debug("GEN package.json...");
@@ -72,7 +72,7 @@ export class SdServerBuildRunner extends BuildRunnerBase<"server"> {
72
72
  const projNpmConf = FsUtils.readJson(
73
73
  path.resolve(process.cwd(), "package.json"),
74
74
  ) as INpmConfig;
75
- const extModules = await this._getExternalModulesAsync();
75
+ const extModules = await this.#getExternalModulesAsync();
76
76
 
77
77
  const deps = extModules.filter((item) => item.exists).map((item) => item.name);
78
78
 
@@ -220,7 +220,7 @@ Options = UnsafeLegacyRenegotiation`.trim(),
220
220
  }
221
221
  }
222
222
 
223
- private async _getExternalModulesAsync(): Promise<
223
+ async #getExternalModulesAsync(): Promise<
224
224
  {
225
225
  name: string;
226
226
  exists: boolean;
@@ -14,16 +14,16 @@ import { resolveAssets } from "@angular/build/src/utils/resolve-assets";
14
14
  import { ScopePathSet } from "../commons/scope-path";
15
15
 
16
16
  export class SdServerBundler {
17
- private _logger = SdLogger.get(["simplysm", "sd-cli", "SdServerBundler"]);
17
+ #logger = SdLogger.get(["simplysm", "sd-cli", "SdServerBundler"]);
18
18
 
19
- private _context?: esbuild.BuildContext;
19
+ #context?: esbuild.BuildContext;
20
20
 
21
- private _modifiedFileSet = new Set<TNormPath>();
22
- private _resultCache: ISdCliServerPluginResultCache = {};
21
+ #modifiedFileSet = new Set<TNormPath>();
22
+ #resultCache: ISdCliServerPluginResultCache = {};
23
23
 
24
- private _outputHashCache = new Map<TNormPath, string>();
24
+ #outputHashCache = new Map<TNormPath, string>();
25
25
 
26
- constructor(private _opt: {
26
+ constructor(private readonly _opt: {
27
27
  dev: boolean;
28
28
  pkgPath: TNormPath;
29
29
  entryPoints: string[];
@@ -38,13 +38,13 @@ export class SdServerBundler {
38
38
  results: ISdBuildMessage[];
39
39
  emitFileSet: Set<TNormPath>;
40
40
  }> {
41
- this._modifiedFileSet.clear();
41
+ this.#modifiedFileSet.clear();
42
42
  if (modifiedFileSet) {
43
- this._modifiedFileSet.adds(...modifiedFileSet);
43
+ this.#modifiedFileSet.adds(...modifiedFileSet);
44
44
  }
45
45
 
46
- if (!this._context) {
47
- this._context = await esbuild.context({
46
+ if (!this.#context) {
47
+ this.#context = await esbuild.context({
48
48
  entryPoints: this._opt.entryPoints,
49
49
  keepNames: true,
50
50
  bundle: true,
@@ -105,10 +105,10 @@ const __dirname = __path__.dirname(__filename);`.trim(),
105
105
  },
106
106
  plugins: [
107
107
  createSdServerPlugin({
108
- modifiedFileSet: this._modifiedFileSet,
108
+ modifiedFileSet: this.#modifiedFileSet,
109
109
  dev: this._opt.dev,
110
110
  pkgPath: this._opt.pkgPath,
111
- result: this._resultCache,
111
+ result: this.#resultCache,
112
112
  watchScopePathSet: this._opt.watchScopePathSet,
113
113
  }),
114
114
  ],
@@ -118,18 +118,18 @@ const __dirname = __path__.dirname(__filename);`.trim(),
118
118
  const emitFileSet = new Set<TNormPath>();
119
119
  let result: esbuild.BuildResult | esbuild.BuildFailure;
120
120
  try {
121
- result = await this._context.rebuild();
121
+ result = await this.#context.rebuild();
122
122
 
123
123
  const outputFiles: BuildOutputFile[] =
124
124
  result.outputFiles?.map((file) => convertOutputFile(file, BuildOutputFileType.Root)) ?? [];
125
125
 
126
126
  for (const outputFile of outputFiles) {
127
127
  const distFilePath = PathUtils.norm(this._opt.pkgPath, outputFile.path);
128
- const prevHash = this._outputHashCache.get(distFilePath);
128
+ const prevHash = this.#outputHashCache.get(distFilePath);
129
129
  const currHash = HashUtils.get(Buffer.from(outputFile.contents));
130
130
  if (prevHash !== currHash) {
131
131
  FsUtils.writeFile(distFilePath, outputFile.contents);
132
- this._outputHashCache.set(distFilePath, currHash);
132
+ this.#outputHashCache.set(distFilePath, currHash);
133
133
  emitFileSet.add(distFilePath);
134
134
  }
135
135
  }
@@ -144,14 +144,14 @@ const __dirname = __path__.dirname(__filename);`.trim(),
144
144
  );
145
145
 
146
146
  for (const assetFile of assetFiles) {
147
- const prevHash = this._outputHashCache.get(PathUtils.norm(assetFile.source));
147
+ const prevHash = this.#outputHashCache.get(PathUtils.norm(assetFile.source));
148
148
  const currHash = FsUtils.hash(assetFile.source);
149
149
  if (prevHash !== currHash) {
150
150
  FsUtils.copy(
151
151
  assetFile.source,
152
152
  path.resolve(this._opt.pkgPath, "dist", assetFile.destination),
153
153
  );
154
- this._outputHashCache.set(PathUtils.norm(assetFile.source), currHash);
154
+ this.#outputHashCache.set(PathUtils.norm(assetFile.source), currHash);
155
155
  emitFileSet.add(PathUtils.norm(assetFile.destination));
156
156
  }
157
157
  }
@@ -160,14 +160,14 @@ const __dirname = __path__.dirname(__filename);`.trim(),
160
160
  result = err;
161
161
  for (const e of err.errors) {
162
162
  if (e.detail != null) {
163
- this._logger.error(e.detail);
163
+ this.#logger.error(e.detail);
164
164
  }
165
165
  }
166
166
  }
167
167
 
168
168
  return {
169
- watchFileSet: this._resultCache.watchFileSet!,
170
- affectedFileSet: this._resultCache.affectedFileSet!,
169
+ watchFileSet: this.#resultCache.watchFileSet!,
170
+ affectedFileSet: this.#resultCache.affectedFileSet!,
171
171
  results: SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(
172
172
  result,
173
173
  this._opt.pkgPath,
@@ -12,9 +12,8 @@ import { SdCliElectron } from "./entry/sd-cli-electron";
12
12
  import { SdCliLocalUpdate } from "./entry/sd-cli-local-update";
13
13
  import { SdCliPostinstall } from "./entry/sd-cli-postinstall";
14
14
  import { SdCliProject } from "./entry/sd-cli-project";
15
- import convertEcmaPrivateToTsPrivate from "./fix/convert-ecma-private-to-ts-private";
16
15
  import {
17
- convertExtendsSdModalBaseToInterface
16
+ convertExtendsSdModalBaseToInterface,
18
17
  } from "./fix/convert-extends-sd-modal-base-to-interface";
19
18
  import convertModalShowParams from "./fix/convert-modal-show-params";
20
19
  import convertSdAngularSymbolNames from "./fix/convert-sd-angular-symbol-names";
@@ -22,10 +21,9 @@ import convertSdSheetBindingsInInlineTemplate
22
21
  from "./fix/convert-sd-sheet-bindings-inInline-template";
23
22
  import convertSetupCumulateSelectedKeysToObjectParam
24
23
  from "./fix/convert-setup-cumulate-selected-keys-to-object-param";
25
- import prefixUnderscoreForAccessModifiers from "./fix/prefix-underscore-for-access-modifiers";
26
24
  import removeSdAngularSymbolNames from "./fix/remove-sd-angular-symbol-names";
27
25
  import {
28
- convertExtendsSdPrintTemplateBaseToInterface
26
+ convertExtendsSdPrintTemplateBaseToInterface,
29
27
  } from "./fix/convert-extends-sd-print-template-base-to-interface";
30
28
  import convertPrintParams from "./fix/convert-print-params";
31
29
  import { convertToUsePermsSignal } from "./fix/convert-to-use-perms-signal";
@@ -33,6 +31,7 @@ import { convertGetMenusToUsableMenus } from "./fix/convert-get-menus-to-usable-
33
31
  import { removeUnusedInjects } from "./fix/remove-unused-injects";
34
32
  import { removeUnusedImports } from "./fix/remove-unused-imports";
35
33
  import { convertFlatPagesToUsableFlatMenus } from "./fix/convert-flat-pages-to-flat-menus";
34
+ import convertPrivateToHash from "./fix/convert-private-to-hash";
36
35
 
37
36
  Error.stackTraceLimit = Infinity;
38
37
  EventEmitter.defaultMaxListeners = 0;
@@ -264,8 +263,19 @@ await yargs(hideBin(process.argv))
264
263
  .command(
265
264
  "fix",
266
265
  "가능한 내용 자동 수정",
267
- (cmd) => cmd.version(false).hide("help").hide("debug"),
268
- () => {
266
+ (cmd) =>
267
+ cmd
268
+ .version(false)
269
+ .hide("help")
270
+ .hide("debug")
271
+ .options({
272
+ library: {
273
+ type: "boolean",
274
+ describe: "simplysm 라이브러리 픽스",
275
+ default: false,
276
+ },
277
+ }),
278
+ (argv) => {
269
279
  // GIT 사용중일 경우, 커밋되지 않은 수정사항이 있는지 확인
270
280
  /*if (FsUtils.exists(path.resolve(process.cwd(), ".git"))) {
271
281
  const gitStatusResult = await SdProcess.spawnAsync("git status");
@@ -274,8 +284,9 @@ await yargs(hideBin(process.argv))
274
284
  }
275
285
  }*/
276
286
 
277
- convertEcmaPrivateToTsPrivate();
278
- prefixUnderscoreForAccessModifiers();
287
+ convertPrivateToHash();
288
+ if (argv.library) return;
289
+
279
290
  convertSdSheetBindingsInInlineTemplate();
280
291
  convertSetupCumulateSelectedKeysToObjectParam();
281
292
  convertExtendsSdModalBaseToInterface();
@@ -1,12 +1,12 @@
1
1
  import { TNormPath } from "@simplysm/sd-core-node";
2
2
 
3
3
  export class SdDependencyCache {
4
- private _exportCache = new Map<
4
+ #exportCache = new Map<
5
5
  /* fileNPath: */ TNormPath,
6
6
  /* exportSymbolSet: */ Set<string>
7
7
  >();
8
8
 
9
- private _importCache = new Map<
9
+ #importCache = new Map<
10
10
  /* fileNPath: */ TNormPath,
11
11
  Map<
12
12
  /* targetNPath: */ TNormPath,
@@ -14,7 +14,7 @@ export class SdDependencyCache {
14
14
  >
15
15
  >();
16
16
 
17
- private _reexportCache = new Map<
17
+ #reexportCache = new Map<
18
18
  /* fileNPath: */ TNormPath,
19
19
  Map<
20
20
  /* targetNPath: */ TNormPath,
@@ -25,7 +25,7 @@ export class SdDependencyCache {
25
25
  >
26
26
  >();
27
27
 
28
- private _revDepCache = new Map<
28
+ #revDepCache = new Map<
29
29
  /* targetNPath: */ TNormPath,
30
30
  Map<
31
31
  /* fileNPath: */ TNormPath,
@@ -33,27 +33,27 @@ export class SdDependencyCache {
33
33
  >
34
34
  >();
35
35
 
36
- private _collectedCache = new Set<TNormPath>();
36
+ #collectedCache = new Set<TNormPath>();
37
37
 
38
38
  getFiles(): Set<TNormPath> {
39
39
  return new Set<TNormPath>([
40
- ...this._collectedCache.keys(),
41
- ...this._revDepCache.keys(),
40
+ ...this.#collectedCache.keys(),
41
+ ...this.#revDepCache.keys(),
42
42
  ]);
43
43
  }
44
44
 
45
45
  addCollected(fileNPath: TNormPath) {
46
- this._collectedCache.add(fileNPath);
46
+ this.#collectedCache.add(fileNPath);
47
47
  }
48
48
 
49
49
  hasCollected(fileNPath: TNormPath) {
50
- return this._collectedCache.has(fileNPath);
50
+ return this.#collectedCache.has(fileNPath);
51
51
  }
52
52
 
53
53
  // export const ...
54
54
  // export function/class/interface A ...
55
55
  addExport(fileNPath: TNormPath, exportSymbol: string) {
56
- const exportSymbolSet = this._exportCache.getOrCreate(fileNPath, new Set());
56
+ const exportSymbolSet = this.#exportCache.getOrCreate(fileNPath, new Set());
57
57
  exportSymbolSet.add(exportSymbol);
58
58
  }
59
59
 
@@ -62,10 +62,10 @@ export class SdDependencyCache {
62
62
  // import(...)
63
63
  // require(...)
64
64
  addImport(fileNPath: TNormPath, targetNPath: TNormPath, targetSymbol: string | 0) {
65
- const importTargetMap = this._importCache.getOrCreate(fileNPath, new Map());
65
+ const importTargetMap = this.#importCache.getOrCreate(fileNPath, new Map());
66
66
  if (targetSymbol === 0) {
67
67
  importTargetMap.set(targetNPath, 0);
68
- this._addRevDep(targetNPath, fileNPath, 0);
68
+ this.#addRevDep(targetNPath, fileNPath, 0);
69
69
  }
70
70
  else {
71
71
  const importTargetSymbolSet = importTargetMap.getOrCreate(targetNPath, new Set());
@@ -74,7 +74,7 @@ export class SdDependencyCache {
74
74
  }
75
75
 
76
76
  importTargetSymbolSet.add(targetSymbol);
77
- this._addRevDep(targetNPath, fileNPath, targetSymbol);
77
+ this.#addRevDep(targetNPath, fileNPath, targetSymbol);
78
78
  }
79
79
  }
80
80
 
@@ -89,10 +89,10 @@ export class SdDependencyCache {
89
89
  targetNPath: TNormPath,
90
90
  targetSymbolInfo: { importSymbol: string, exportSymbol: string } | 0,
91
91
  ) {
92
- const reexportTargetMap = this._reexportCache.getOrCreate(fileNPath, new Map());
92
+ const reexportTargetMap = this.#reexportCache.getOrCreate(fileNPath, new Map());
93
93
  if (targetSymbolInfo === 0) {
94
94
  reexportTargetMap.set(targetNPath, 0);
95
- this._addRevDep(targetNPath, fileNPath, 0);
95
+ this.#addRevDep(targetNPath, fileNPath, 0);
96
96
  }
97
97
  else {
98
98
  const reexportTargetSymbolInfos = reexportTargetMap.getOrCreate(targetNPath, []);
@@ -107,13 +107,13 @@ export class SdDependencyCache {
107
107
  )
108
108
  ) {
109
109
  reexportTargetSymbolInfos.push(targetSymbolInfo);
110
- this._addRevDep(targetNPath, fileNPath, targetSymbolInfo.importSymbol);
110
+ this.#addRevDep(targetNPath, fileNPath, targetSymbolInfo.importSymbol);
111
111
  }
112
112
  }
113
113
  }
114
114
 
115
- private _addRevDep(targetNPath: TNormPath, fileNPath: TNormPath, exportSymbol: string | 0) {
116
- const revDepInfoMap = this._revDepCache.getOrCreate(targetNPath, new Map());
115
+ #addRevDep(targetNPath: TNormPath, fileNPath: TNormPath, exportSymbol: string | 0) {
116
+ const revDepInfoMap = this.#revDepCache.getOrCreate(targetNPath, new Map());
117
117
  if (exportSymbol === 0) {
118
118
  revDepInfoMap.set(fileNPath, exportSymbol);
119
119
  }
@@ -143,7 +143,7 @@ export class SdDependencyCache {
143
143
  };
144
144
 
145
145
  for (const modifiedNPath of modifiedNPathSet) {
146
- const exportSymbols = this._getExportSymbols(modifiedNPath);
146
+ const exportSymbols = this.#getExportSymbols(modifiedNPath);
147
147
  if (exportSymbols.size === 0) {
148
148
  enqueue(modifiedNPath, undefined);
149
149
  }
@@ -161,7 +161,7 @@ export class SdDependencyCache {
161
161
  if (visited.has(key)) continue;
162
162
  visited.add(key);*/
163
163
 
164
- const revDepInfoMap = this._revDepCache.get(curr.fileNPath);
164
+ const revDepInfoMap = this.#revDepCache.get(curr.fileNPath);
165
165
  if (!revDepInfoMap) continue;
166
166
 
167
167
  for (const [revDepFileNPath, revDepInfo] of revDepInfoMap) {
@@ -173,7 +173,7 @@ export class SdDependencyCache {
173
173
  result.add(revDepFileNPath);
174
174
 
175
175
  // 하위 Deps를 queue에 넣기전 export명칭 변환 (이름을 변경한 reexport일 경우 필요)
176
- const exportSymbol = this._convertImportSymbolToExportSymbol(
176
+ const exportSymbol = this.#convertImportSymbolToExportSymbol(
177
177
  revDepFileNPath,
178
178
  curr.fileNPath,
179
179
  curr.exportSymbol, // revdep의 importSymbol
@@ -194,31 +194,31 @@ export class SdDependencyCache {
194
194
  const affectedFiles = this.getAffectedFileSet(fileNPathSet);
195
195
 
196
196
  for (const fileNPath of affectedFiles) {
197
- this._exportCache.delete(fileNPath);
198
- this._importCache.delete(fileNPath);
199
- this._reexportCache.delete(fileNPath);
200
- this._collectedCache.delete(fileNPath);
201
- this._revDepCache.delete(fileNPath); // ← 자기 자신이 key인 경우도 정리
197
+ this.#exportCache.delete(fileNPath);
198
+ this.#importCache.delete(fileNPath);
199
+ this.#reexportCache.delete(fileNPath);
200
+ this.#collectedCache.delete(fileNPath);
201
+ this.#revDepCache.delete(fileNPath); // ← 자기 자신이 key인 경우도 정리
202
202
  }
203
203
 
204
204
  // _revDepCache는 역방향으로 순회
205
- for (const [targetNPath, infoMap] of this._revDepCache) {
205
+ for (const [targetNPath, infoMap] of this.#revDepCache) {
206
206
  for (const fileNPath of affectedFiles) {
207
207
  infoMap.delete(fileNPath);
208
208
  }
209
209
 
210
210
  if (infoMap.size === 0) {
211
- this._revDepCache.delete(targetNPath);
211
+ this.#revDepCache.delete(targetNPath);
212
212
  }
213
213
  }
214
214
  }
215
215
 
216
- private _convertImportSymbolToExportSymbol(
216
+ #convertImportSymbolToExportSymbol(
217
217
  fileNPath: TNormPath,
218
218
  targetNPath: TNormPath,
219
219
  importSymbol: string,
220
220
  ) {
221
- const symbolInfos = this._reexportCache.get(fileNPath)?.get(targetNPath);
221
+ const symbolInfos = this.#reexportCache.get(fileNPath)?.get(targetNPath);
222
222
  if (symbolInfos != null && symbolInfos !== 0 && symbolInfos.length > 0) {
223
223
  const symbolInfo = symbolInfos.single(item => item.importSymbol === importSymbol);
224
224
  if (symbolInfo) {
@@ -229,19 +229,19 @@ export class SdDependencyCache {
229
229
  return importSymbol;
230
230
  }
231
231
 
232
- private _getExportSymbols(fileNPath: TNormPath): Set<string> {
232
+ #getExportSymbols(fileNPath: TNormPath): Set<string> {
233
233
  const result = new Set<string>();
234
234
 
235
- const set = this._exportCache.get(fileNPath);
235
+ const set = this.#exportCache.get(fileNPath);
236
236
  if (set) {
237
237
  result.adds(...set);
238
238
  }
239
239
 
240
- const map = this._reexportCache.get(fileNPath);
240
+ const map = this.#reexportCache.get(fileNPath);
241
241
  if (map) {
242
242
  for (const [key, val] of map) {
243
243
  if (val === 0) {
244
- result.adds(...this._getExportSymbols(key));
244
+ result.adds(...this.#getExportSymbols(key));
245
245
  }
246
246
  else {
247
247
  result.adds(...val.map(item => item.exportSymbol));
@@ -277,7 +277,7 @@ export class SdDependencyCache {
277
277
  };
278
278
  nodeMap.set(key, node);
279
279
 
280
- const revDepInfoMap = this._revDepCache.get(fileNPath);
280
+ const revDepInfoMap = this.#revDepCache.get(fileNPath);
281
281
  if (!revDepInfoMap) return node;
282
282
 
283
283
  for (const [revDepFileNPath, revDepInfo] of revDepInfoMap.entries()) {
@@ -286,7 +286,7 @@ export class SdDependencyCache {
286
286
  if (!hasImportSymbol) continue;
287
287
 
288
288
  const nextExportSymbol = exportSymbol != null
289
- ? this._convertImportSymbolToExportSymbol(
289
+ ? this.#convertImportSymbolToExportSymbol(
290
290
  revDepFileNPath,
291
291
  fileNPath,
292
292
  exportSymbol
@@ -306,7 +306,7 @@ export class SdDependencyCache {
306
306
  const result: ISdAffectedFileTreeNode[] = [];
307
307
 
308
308
  for (const modifiedNPath of modifiedNPathSet) {
309
- const exportSymbols = this._getExportSymbols(modifiedNPath);
309
+ const exportSymbols = this.#getExportSymbols(modifiedNPath);
310
310
  if (exportSymbols.size === 0) {
311
311
  const rootNode = buildTree(modifiedNPath, undefined);
312
312
  result.push(rootNode);