@simplysm/sd-cli 12.5.23 → 12.5.26

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 (67) hide show
  1. package/dist/entry/SdCliCordova.js +6 -6
  2. package/dist/entry/SdCliCordova.js.map +1 -1
  3. package/dist/entry/SdCliElectron.js +2 -2
  4. package/dist/entry/SdCliElectron.js.map +1 -1
  5. package/dist/entry/SdCliLocalUpdate.js +5 -7
  6. package/dist/entry/SdCliLocalUpdate.js.map +1 -1
  7. package/dist/entry/SdCliProject.js +4 -4
  8. package/dist/entry/SdCliProject.js.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/pkg-builders/SdMultiBuildRunner.d.ts +3 -10
  13. package/dist/pkg-builders/SdMultiBuildRunner.js +132 -116
  14. package/dist/pkg-builders/SdMultiBuildRunner.js.map +1 -1
  15. package/dist/pkg-builders/client/SdClientBuildRunner.d.ts +6 -5
  16. package/dist/pkg-builders/client/SdClientBuildRunner.js +16 -8
  17. package/dist/pkg-builders/client/SdClientBuildRunner.js.map +1 -1
  18. package/dist/pkg-builders/client/SdNgBundler.js +1 -0
  19. package/dist/pkg-builders/client/SdNgBundler.js.map +1 -1
  20. package/dist/pkg-builders/client/createSdNgPlugin.js +3 -3
  21. package/dist/pkg-builders/client/createSdNgPlugin.js.map +1 -1
  22. package/dist/pkg-builders/lib/SdTsLibBuildRunner.d.ts +6 -1
  23. package/dist/pkg-builders/lib/SdTsLibBuildRunner.js +25 -26
  24. package/dist/pkg-builders/lib/SdTsLibBuildRunner.js.map +1 -1
  25. package/dist/pkg-builders/lib/SdTsLibBuilder.d.ts +2 -3
  26. package/dist/pkg-builders/lib/SdTsLibBuilder.js +7 -11
  27. package/dist/pkg-builders/lib/SdTsLibBuilder.js.map +1 -1
  28. package/dist/pkg-builders/server/SdServerBuildRunner.d.ts +5 -1
  29. package/dist/pkg-builders/server/SdServerBuildRunner.js +32 -29
  30. package/dist/pkg-builders/server/SdServerBuildRunner.js.map +1 -1
  31. package/dist/pkg-builders/server/createSdServerPlugin.js +3 -3
  32. package/dist/pkg-builders/server/createSdServerPlugin.js.map +1 -1
  33. package/dist/ts-builder/SdTsCompiler.js +172 -160
  34. package/dist/ts-builder/SdTsCompiler.js.map +1 -1
  35. package/dist/types/build-runner.type.d.ts +7 -0
  36. package/dist/types/build-runner.type.js +2 -0
  37. package/dist/types/build-runner.type.js.map +1 -0
  38. package/dist/types/workers.type.d.ts +14 -0
  39. package/dist/workers/build-runner-worker.js +49 -0
  40. package/dist/workers/build-runner-worker.js.map +1 -0
  41. package/package.json +10 -10
  42. package/src/entry/SdCliCordova.ts +6 -5
  43. package/src/entry/SdCliElectron.ts +2 -2
  44. package/src/entry/SdCliLocalUpdate.ts +7 -7
  45. package/src/entry/SdCliProject.ts +4 -4
  46. package/src/index.ts +1 -1
  47. package/src/pkg-builders/SdMultiBuildRunner.ts +122 -120
  48. package/src/pkg-builders/client/SdClientBuildRunner.ts +26 -22
  49. package/src/pkg-builders/client/SdNgBundler.ts +1 -0
  50. package/src/pkg-builders/client/createSdNgPlugin.ts +3 -3
  51. package/src/pkg-builders/lib/SdTsLibBuildRunner.ts +39 -26
  52. package/src/pkg-builders/lib/SdTsLibBuilder.ts +12 -13
  53. package/src/pkg-builders/server/SdServerBuildRunner.ts +44 -29
  54. package/src/pkg-builders/server/createSdServerPlugin.ts +3 -3
  55. package/src/ts-builder/SdTsCompiler.ts +220 -216
  56. package/src/types/build-runner.type.ts +8 -0
  57. package/src/types/workers.type.ts +13 -0
  58. package/src/workers/build-runner-worker.ts +56 -0
  59. package/tsconfig.json +1 -1
  60. package/dist/ts-builder/SdTsCompileWorker.d.ts +0 -9
  61. package/dist/ts-builder/SdTsCompileWorker.js +0 -16
  62. package/dist/ts-builder/SdTsCompileWorker.js.map +0 -1
  63. package/dist/workers/compile-worker.js +0 -27
  64. package/dist/workers/compile-worker.js.map +0 -1
  65. package/src/ts-builder/SdTsCompileWorker.ts +0 -21
  66. package/src/workers/compile-worker.ts +0 -31
  67. /package/dist/workers/{compile-worker.d.ts → build-runner-worker.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/sd-cli",
3
- "version": "12.5.23",
3
+ "version": "12.5.26",
4
4
  "description": "심플리즘 패키지 - CLI",
5
5
  "author": "김석래",
6
6
  "repository": {
@@ -17,18 +17,18 @@
17
17
  "postinstall": "node lib/postinstall.js"
18
18
  },
19
19
  "dependencies": {
20
- "@angular/build": "^18.2.7",
21
- "@angular/compiler": "^18.2.7",
22
- "@angular/compiler-cli": "^18.2.7",
20
+ "@angular/build": "^18.2.8",
21
+ "@angular/compiler": "^18.2.8",
22
+ "@angular/compiler-cli": "^18.2.8",
23
23
  "@electron/rebuild": "^3.7.0",
24
- "@simplysm/sd-core-common": "12.5.23",
25
- "@simplysm/sd-core-node": "12.5.23",
26
- "@simplysm/sd-service-server": "12.5.23",
27
- "@simplysm/sd-storage": "12.5.23",
24
+ "@simplysm/sd-core-common": "12.5.26",
25
+ "@simplysm/sd-core-node": "12.5.26",
26
+ "@simplysm/sd-service-server": "12.5.26",
27
+ "@simplysm/sd-storage": "12.5.26",
28
28
  "browserslist": "^4.24.0",
29
29
  "cordova": "^12.0.0",
30
30
  "css-has-pseudo": "^7.0.0",
31
- "electron": "^32.1.2",
31
+ "electron": "^32.2.0",
32
32
  "electron-builder": "^25.1.8",
33
33
  "esbuild": "^0.24.0",
34
34
  "eslint": "^9.12.0",
@@ -37,7 +37,7 @@
37
37
  "node-stdlib-browser": "^1.2.1",
38
38
  "postcss": "^8.4.47",
39
39
  "rxjs": "^7.8.1",
40
- "sass": "^1.79.4",
40
+ "sass": "^1.79.5",
41
41
  "semver": "^7.6.3",
42
42
  "specifier-resolution-node": "^1.1.4",
43
43
  "typescript": "~5.5.4",
@@ -50,11 +50,12 @@ export class SdCliCordova {
50
50
  const alreadyPlatforms = FsUtil.readdir(path.resolve(cordovaPath, "platforms"));
51
51
  for (const platform of this._platforms) {
52
52
  if (!alreadyPlatforms.includes(platform)) {
53
- if (platform === "android") {
54
- await this._execAsync(`${BIN_PATH} platform add ${platform}@12.0.0`, cordovaPath);
55
- } else {
56
- await this._execAsync(`${BIN_PATH} platform add ${platform}`, cordovaPath);
57
- }
53
+ await this._execAsync(`${BIN_PATH} platform add ${platform}`, cordovaPath);
54
+ // if (platform === "android") {
55
+ // await this._execAsync(`${BIN_PATH} platform add ${platform}@12.0.0`, cordovaPath);
56
+ // } else {
57
+ // await this._execAsync(`${BIN_PATH} platform add ${platform}`, cordovaPath);
58
+ // }
58
59
  }
59
60
  }
60
61
 
@@ -135,7 +135,7 @@ export class SdCliElectron {
135
135
  },
136
136
  ...(pkgConf.builder.electron.installerIcon !== undefined
137
137
  ? {
138
- icon: path.resolve(pkgPath, "src", pkgConf.builder.electron.installerIcon),
138
+ icon: path.resolve(pkgPath, pkgConf.builder.electron.installerIcon),
139
139
  }
140
140
  : {}),
141
141
  removePackageScripts: false,
@@ -209,7 +209,7 @@ export class SdCliElectron {
209
209
  },
210
210
  ...(opt.config.installerIcon !== undefined
211
211
  ? {
212
- icon: path.resolve(opt.pkgPath, "src", opt.config.installerIcon),
212
+ icon: path.resolve(opt.pkgPath, opt.config.installerIcon),
213
213
  }
214
214
  : {}),
215
215
  removePackageScripts: false,
@@ -45,9 +45,9 @@ export class SdCliLocalUpdate {
45
45
  const updatePathInfos = this.#getUpdatePathInfos(projConf.localUpdates);
46
46
  logger.debug("로컬 업데이트 구성");
47
47
 
48
- const watchPaths = updatePathInfos.mapMany((item) => this.#getWatchPaths(item.source)).distinct();
48
+ // const watchPaths = updatePathInfos.mapMany((item) => this.#getWatchPaths(item.source)).distinct();
49
49
 
50
- const watcher = SdFsWatcher.watch(watchPaths);
50
+ const watcher = SdFsWatcher.watch(updatePathInfos.map((item) => item.source));
51
51
  watcher.onChange({ delay: 500 }, (changedInfos) => {
52
52
  const changedFileInfos = changedInfos.filter((item) => ["add", "change", "unlink"].includes(item.event));
53
53
  if (changedFileInfos.length === 0) return;
@@ -71,9 +71,9 @@ export class SdCliLocalUpdate {
71
71
  }
72
72
  }
73
73
 
74
- const watchFileSet = new Set(updatePathInfos.mapMany((item) => this.#getWatchPaths(item.source)));
75
-
76
- watcher.replaceWatchPaths(watchFileSet);
74
+ // const watchFileSet = new Set(updatePathInfos.mapMany((item) => this.#getWatchPaths(item.source)));
75
+ //
76
+ // watcher.replaceWatchPaths(watchFileSet);
77
77
 
78
78
  logger.info("로컬 라이브러리 복사 완료");
79
79
  });
@@ -110,9 +110,9 @@ export class SdCliLocalUpdate {
110
110
  return result;
111
111
  }
112
112
 
113
- static #getWatchPaths(sourcePath: string): string[] {
113
+ /*static #getWatchPaths(sourcePath: string): string[] {
114
114
  return FsUtil.glob(path.resolve(sourcePath, "**"));
115
- }
115
+ }*/
116
116
  }
117
117
 
118
118
  interface IUpdatePathInfo {
@@ -103,10 +103,10 @@ export class SdCliProject {
103
103
  await this._upgradeVersionAsync(projNpmConf, allPkgPaths);
104
104
 
105
105
  logger.debug("빌드 프로세스 시작...");
106
- const parallelBuildRunner = new SdMultiBuildRunner();
106
+ const multiBuildRunner = new SdMultiBuildRunner();
107
107
 
108
108
  const messages = await pkgPaths.parallelAsync(async (pkgPath) => {
109
- return await parallelBuildRunner.runAsync({
109
+ return await multiBuildRunner.runAsync({
110
110
  cmd: "build",
111
111
  pkgPath,
112
112
  projConf: projConf,
@@ -165,10 +165,10 @@ export class SdCliProject {
165
165
  // 빌드
166
166
  if (!opt.noBuild) {
167
167
  logger.debug("빌드 프로세스 시작...");
168
- const parallelBuildRunner = new SdMultiBuildRunner();
168
+ const multiBuildRunner = new SdMultiBuildRunner();
169
169
 
170
170
  const messages = await pkgPaths.parallelAsync(async (pkgPath) => {
171
- return await parallelBuildRunner.runAsync({
171
+ return await multiBuildRunner.runAsync({
172
172
  cmd: "build",
173
173
  pkgPath,
174
174
  projConf: projConf,
package/src/index.ts CHANGED
@@ -16,8 +16,8 @@ export * from "./pkg-builders/server/createSdServerPlugin";
16
16
  export * from "./pkg-builders/server/SdServerBuildRunner";
17
17
  export * from "./pkg-builders/server/SdServerBundler";
18
18
  export * from "./ts-builder/SdTsCompiler";
19
- export * from "./ts-builder/SdTsCompileWorker";
20
19
  export * from "./types/build-plugin.type";
20
+ export * from "./types/build-runner.type";
21
21
  export * from "./types/build.type";
22
22
  export * from "./types/common-configs.type";
23
23
  export * from "./types/sd-configs.type";
@@ -1,14 +1,11 @@
1
1
  import { FsUtil, Logger, PathUtil, SdWorker, TNormPath } from "@simplysm/sd-core-node";
2
2
  import path from "path";
3
3
  import { EventEmitter } from "events";
4
- import { SdServerBuildRunner } from "./server/SdServerBuildRunner";
5
- import { SdClientBuildRunner } from "./client/SdClientBuildRunner";
6
- import { SdTsLibBuildRunner } from "./lib/SdTsLibBuildRunner";
7
- import { SdJsLibBuildRunner } from "./lib/SdJsLibBuildRunner";
8
- import { ISdProjectConfig, ISdServerPackageConfig } from "../types/sd-configs.type";
4
+ import { ISdServerPackageConfig } from "../types/sd-configs.type";
9
5
  import { ISdBuildMessage, ISdBuildRunnerResult } from "../types/build.type";
10
- import { TServerWorkerType } from "../types/workers.type";
6
+ import { TSdBuildRunnerWorkerType, TServerWorkerType } from "../types/workers.type";
11
7
  import { INpmConfig } from "../types/common-configs.type";
8
+ import { ISdBuildRunnerWorkerRequest } from "../types/build-runner.type";
12
9
 
13
10
  export class SdMultiBuildRunner extends EventEmitter {
14
11
  #logger = Logger.get(["simplysm", "sd-cli", "SdMultiBuildRunner"]);
@@ -43,10 +40,20 @@ export class SdMultiBuildRunner extends EventEmitter {
43
40
  return this;
44
41
  }
45
42
 
46
- async runAsync(req: IRequest & { cmd: "watch" }): Promise<void>;
47
- async runAsync(req: IRequest & { cmd: "build" }): Promise<ISdBuildMessage[]>;
48
- async runAsync(req: IRequest): Promise<ISdBuildMessage[] | void> {
49
- const pkgConf = req.projConf.packages[path.basename(req.pkgPath)]!;
43
+ async runAsync(req: ISdBuildRunnerWorkerRequest & { cmd: "watch" }): Promise<void>;
44
+ async runAsync(req: ISdBuildRunnerWorkerRequest & { cmd: "build" }): Promise<ISdBuildMessage[]>;
45
+ async runAsync(req: ISdBuildRunnerWorkerRequest): Promise<ISdBuildMessage[] | void> {
46
+ const worker = new SdWorker<TSdBuildRunnerWorkerType>(import.meta.resolve("../workers/build-runner-worker"))
47
+ .on("change", () => {
48
+ if (this.#busyCount === 0) {
49
+ this.emit("change");
50
+ }
51
+ this.#busyCount++;
52
+ })
53
+ .on("complete", (result) => this.#onComplete(req, result));
54
+
55
+ return await worker.run("run", [req]);
56
+ /*const pkgConf = req.projConf.packages[path.basename(req.pkgPath)]!;
50
57
 
51
58
  const buildRunnerType =
52
59
  pkgConf.type === "server"
@@ -67,140 +74,133 @@ export class SdMultiBuildRunner extends EventEmitter {
67
74
  } else {
68
75
  await builder.watchAsync();
69
76
  return;
70
- }
77
+ }*/
71
78
  }
72
79
 
73
- #onMessage(req: IRequest, res: TResponse) {
74
- if (res.type === "change") {
75
- if (this.#busyCount === 0) {
76
- this.emit("change");
77
- }
78
- this.#busyCount++;
79
- } else {
80
- this.#resultCache.delete(req.pkgPath);
81
- for (const affectedFilePath of res.result.affectedFilePathSet) {
82
- if (PathUtil.isChildPath(affectedFilePath, req.pkgPath)) {
83
- this.#resultCache.delete(affectedFilePath);
84
- }
80
+ #onComplete(req: ISdBuildRunnerWorkerRequest, result: ISdBuildRunnerResult) {
81
+ this.#resultCache.delete(req.pkgPath);
82
+ for (const affectedFilePath of result.affectedFilePathSet) {
83
+ if (PathUtil.isChildPath(affectedFilePath, req.pkgPath)) {
84
+ this.#resultCache.delete(affectedFilePath);
85
85
  }
86
+ }
86
87
 
87
- for (const buildMessage of res.result.buildMessages) {
88
- const cacheItem = this.#resultCache.getOrCreate(buildMessage.filePath ?? req.pkgPath, []);
89
- cacheItem.push(buildMessage);
90
- }
88
+ for (const buildMessage of result.buildMessages) {
89
+ const cacheItem = this.#resultCache.getOrCreate(buildMessage.filePath ?? req.pkgPath, []);
90
+ cacheItem.push(buildMessage);
91
+ }
92
+
93
+ const pkgConf = req.projConf.packages[path.basename(req.pkgPath)]!;
91
94
 
92
- const pkgConf = req.projConf.packages[path.basename(req.pkgPath)]!;
95
+ if (pkgConf.type === "server") {
96
+ const pkgName = path.basename(req.pkgPath);
97
+ const serverInfo = this.#serverInfoMap.getOrCreate(pkgName, {
98
+ hasChanges: true,
99
+ clientChangedFileSet: new Set(),
100
+ clients: {},
101
+ });
102
+
103
+ const serverPkgConf = req.projConf.packages[pkgName] as ISdServerPackageConfig;
104
+ serverInfo.pkgInfo = {
105
+ path: req.pkgPath,
106
+ conf: serverPkgConf,
107
+ };
108
+
109
+ serverInfo.hasChanges = true;
110
+ } else if (pkgConf.type === "client") {
111
+ const pkgName = path.basename(req.pkgPath);
112
+
113
+ if (pkgConf.server !== undefined) {
114
+ const serverInfo = this.#serverInfoMap.getOrCreate(
115
+ typeof pkgConf.server === "string" ? pkgConf.server : pkgConf.server.port.toString(),
116
+ {
117
+ hasChanges: true,
118
+ clientChangedFileSet: new Set(),
119
+ clients: {},
120
+ },
121
+ );
93
122
 
94
- if (pkgConf.type === "server") {
95
- const pkgName = path.basename(req.pkgPath);
123
+ if (typeof pkgConf.server !== "string") {
124
+ serverInfo.pkgInfo = pkgConf.server;
125
+ }
126
+
127
+ serverInfo.clients[pkgName] = {
128
+ path: path.resolve(req.pkgPath, "dist"),
129
+ buildTypes: (pkgConf.builder ? Object.keys(pkgConf.builder) : ["web"]) as any,
130
+ };
131
+
132
+ serverInfo.clientChangedFileSet.adds(...result.emitFileSet);
133
+ } else {
96
134
  const serverInfo = this.#serverInfoMap.getOrCreate(pkgName, {
97
135
  hasChanges: true,
98
136
  clientChangedFileSet: new Set(),
99
137
  clients: {},
100
138
  });
101
139
 
102
- const serverPkgConf = req.projConf.packages[pkgName] as ISdServerPackageConfig;
103
- serverInfo.pkgInfo = {
104
- path: req.pkgPath,
105
- conf: serverPkgConf,
106
- };
107
-
108
- serverInfo.hasChanges = true;
109
- } else if (pkgConf.type === "client") {
110
- const pkgName = path.basename(req.pkgPath);
111
-
112
- if (pkgConf.server !== undefined) {
113
- const serverInfo = this.#serverInfoMap.getOrCreate(
114
- typeof pkgConf.server === "string" ? pkgConf.server : pkgConf.server.port.toString(),
115
- {
116
- hasChanges: true,
117
- clientChangedFileSet: new Set(),
118
- clients: {},
119
- },
120
- );
121
-
122
- if (typeof pkgConf.server !== "string") {
123
- serverInfo.pkgInfo = pkgConf.server;
124
- }
125
-
126
- serverInfo.clients[pkgName] = {
127
- path: path.resolve(req.pkgPath, "dist"),
128
- buildTypes: (pkgConf.builder ? Object.keys(pkgConf.builder) : ["web"]) as any,
129
- };
130
-
131
- serverInfo.clientChangedFileSet.adds(...res.result.emitFileSet);
132
- } else {
133
- const serverInfo = this.#serverInfoMap.getOrCreate(pkgName, {
134
- hasChanges: true,
135
- clientChangedFileSet: new Set(),
136
- clients: {},
137
- });
138
-
139
- serverInfo.clientChangedFileSet.adds(...res.result.emitFileSet);
140
- }
140
+ serverInfo.clientChangedFileSet.adds(...result.emitFileSet);
141
141
  }
142
+ }
142
143
 
143
- setTimeout(async () => {
144
- this.#busyCount--;
145
- if (this.#busyCount === 0) {
146
- for (const serverPkgNameOrPort of this.#serverInfoMap.keys()) {
147
- const serverInfo = this.#serverInfoMap.get(serverPkgNameOrPort)!;
148
- if (serverInfo.pkgInfo && serverInfo.hasChanges) {
149
- this.#logger.debug("서버 재시작...");
150
- try {
151
- const restartServerResult = await this.#restartServerAsync(serverInfo.pkgInfo, serverInfo.worker);
152
- serverInfo.worker = restartServerResult.worker;
153
- serverInfo.port = restartServerResult.port;
154
- serverInfo.hasChanges = false;
155
- } catch (err) {
156
- this.#logger.error(err);
157
- }
144
+ setTimeout(async () => {
145
+ this.#busyCount--;
146
+ if (this.#busyCount === 0) {
147
+ for (const serverPkgNameOrPort of this.#serverInfoMap.keys()) {
148
+ const serverInfo = this.#serverInfoMap.get(serverPkgNameOrPort)!;
149
+ if (serverInfo.pkgInfo && serverInfo.hasChanges) {
150
+ this.#logger.debug("서버 재시작...");
151
+ try {
152
+ const restartServerResult = await this.#restartServerAsync(serverInfo.pkgInfo, serverInfo.worker);
153
+ serverInfo.worker = restartServerResult.worker;
154
+ serverInfo.port = restartServerResult.port;
155
+ serverInfo.hasChanges = false;
156
+ } catch (err) {
157
+ this.#logger.error(err);
158
158
  }
159
+ }
159
160
 
160
- if (serverInfo.worker) {
161
- this.#logger.debug("클라이언트 설정...");
162
- await serverInfo.worker.run("setPathProxy", [
163
- {
164
- ...Object.keys(serverInfo.clients).toObject(
165
- (key) => key,
166
- (key) => serverInfo.clients[key].path,
167
- ),
168
- node_modules: path.resolve(process.cwd(), "node_modules"),
169
- },
170
- ]);
171
-
172
- if (serverInfo.clientChangedFileSet.size > 0) {
173
- this.#logger.debug("클라이언트 새로고침...");
174
- await serverInfo.worker.run("broadcastReload", [serverInfo.clientChangedFileSet]);
175
- }
161
+ if (serverInfo.worker) {
162
+ this.#logger.debug("클라이언트 설정...");
163
+ await serverInfo.worker.run("setPathProxy", [
164
+ {
165
+ ...Object.keys(serverInfo.clients).toObject(
166
+ (key) => key,
167
+ (key) => serverInfo.clients[key].path,
168
+ ),
169
+ node_modules: path.resolve(process.cwd(), "node_modules"),
170
+ },
171
+ ]);
172
+
173
+ if (serverInfo.clientChangedFileSet.size > 0) {
174
+ this.#logger.debug("클라이언트 새로고침...");
175
+ await serverInfo.worker.run("broadcastReload", [serverInfo.clientChangedFileSet]);
176
176
  }
177
177
  }
178
+ }
178
179
 
179
- const clientPaths: string[] = [];
180
- for (const serverInfo of this.#serverInfoMap.values()) {
181
- if (Object.keys(serverInfo.clients).length > 0) {
182
- for (const clientPkgName of Object.keys(serverInfo.clients)) {
183
- for (const buildType of serverInfo.clients[clientPkgName].buildTypes) {
184
- if (buildType === "web") {
185
- clientPaths.push(`http://localhost:${serverInfo.port}/${clientPkgName}/`);
186
- } else {
187
- clientPaths.push(`http://localhost:${serverInfo.port}/${clientPkgName}/${buildType}/`);
188
- }
180
+ const clientPaths: string[] = [];
181
+ for (const serverInfo of this.#serverInfoMap.values()) {
182
+ if (Object.keys(serverInfo.clients).length > 0) {
183
+ for (const clientPkgName of Object.keys(serverInfo.clients)) {
184
+ for (const buildType of serverInfo.clients[clientPkgName].buildTypes) {
185
+ if (buildType === "web") {
186
+ clientPaths.push(`http://localhost:${serverInfo.port}/${clientPkgName}/`);
187
+ } else {
188
+ clientPaths.push(`http://localhost:${serverInfo.port}/${clientPkgName}/${buildType}/`);
189
189
  }
190
190
  }
191
- } else {
192
- clientPaths.push(`http://localhost:${serverInfo.port}/`);
193
191
  }
192
+ } else {
193
+ clientPaths.push(`http://localhost:${serverInfo.port}/`);
194
194
  }
195
- if (clientPaths.length > 0) {
196
- this.#logger.info("클라이언트 개발 서버 접속 주소\n" + clientPaths.join("\n"));
197
- }
198
-
199
- const messages = Array.from(this.#resultCache.values()).mapMany();
200
- this.emit("complete", messages);
201
195
  }
202
- }, 300);
203
- }
196
+ if (clientPaths.length > 0) {
197
+ this.#logger.info("클라이언트 개발 서버 접속 주소\n" + clientPaths.join("\n"));
198
+ }
199
+
200
+ const messages = Array.from(this.#resultCache.values()).mapMany();
201
+ this.emit("complete", messages);
202
+ }
203
+ }, 300);
204
204
  }
205
205
 
206
206
  async #restartServerAsync(
@@ -234,6 +234,7 @@ export class SdMultiBuildRunner extends EventEmitter {
234
234
  }
235
235
  }
236
236
 
237
+ /*
237
238
  interface IRequest {
238
239
  cmd: "watch" | "build";
239
240
  pkgPath: TNormPath;
@@ -248,3 +249,4 @@ type TResponse =
248
249
  type: "complete";
249
250
  result: ISdBuildRunnerResult;
250
251
  };
252
+ */
@@ -10,19 +10,27 @@ import { INpmConfig } from "../../types/common-configs.type";
10
10
  import { ISdBuildMessage, ISdBuildRunnerResult } from "../../types/build.type";
11
11
 
12
12
  export class SdClientBuildRunner extends EventEmitter {
13
- private readonly _logger = Logger.get(["simplysm", "sd-cli", "SdClientBuildRunner"]);
14
- private readonly _pkgConf: ISdClientPackageConfig;
15
- private readonly _npmConf: INpmConfig;
13
+ private _logger = Logger.get(["simplysm", "sd-cli", "SdClientBuildRunner"]);
14
+ private _pkgConf: ISdClientPackageConfig;
15
+ private _npmConf: INpmConfig;
16
16
  private _ngBundlers?: SdNgBundler[];
17
17
  private _cordova?: SdCliCordova;
18
+ private _watchScopePathSet: Set<TNormPath>;
18
19
 
19
20
  public constructor(
20
- private readonly _projConf: ISdProjectConfig,
21
- private readonly _pkgPath: TNormPath,
21
+ private _projConf: ISdProjectConfig,
22
+ private _pkgPath: TNormPath,
22
23
  ) {
23
24
  super();
24
25
  this._pkgConf = this._projConf.packages[path.basename(_pkgPath)] as ISdClientPackageConfig;
25
26
  this._npmConf = FsUtil.readJson(path.resolve(_pkgPath, "package.json")) as INpmConfig;
27
+
28
+ const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {}).mapMany((key) =>
29
+ FsUtil.glob(path.resolve(this._pkgPath, "../../node_modules", key)),
30
+ );
31
+ this._watchScopePathSet = new Set(
32
+ [path.resolve(this._pkgPath, "../"), ...localUpdatePaths].map((item) => PathUtil.norm(item)),
33
+ );
26
34
  }
27
35
 
28
36
  public override on(event: "change", listener: () => void): this;
@@ -77,11 +85,15 @@ export class SdClientBuildRunner extends EventEmitter {
77
85
  this.emit("complete", res);
78
86
 
79
87
  this._debug("WATCH...");
80
- const watcher = SdFsWatcher.watch(Array.from(result.watchFileSet)).onChange({ delay: 100 }, async (changeInfos) => {
88
+ let lastWatchFileSet = result.watchFileSet;
89
+ SdFsWatcher.watch(Array.from(this._watchScopePathSet)).onChange({ delay: 100 }, async (changeInfos) => {
90
+ const currentChangeInfos = changeInfos.filter((item) => lastWatchFileSet.has(item.path));
91
+ if (currentChangeInfos.length < 1) return;
92
+
81
93
  this.emit("change");
82
94
 
83
95
  for (const ngBundler of this._ngBundlers!) {
84
- ngBundler.markForChanges(changeInfos.map((item) => item.path));
96
+ ngBundler.markForChanges(currentChangeInfos.map((item) => item.path));
85
97
  }
86
98
 
87
99
  const watchResult = await this._runAsync({ dev: !this._pkgConf.forceProductionMode });
@@ -92,7 +104,7 @@ export class SdClientBuildRunner extends EventEmitter {
92
104
  };
93
105
  this.emit("complete", watchRes);
94
106
 
95
- watcher.replaceWatchPaths(watchResult.watchFileSet);
107
+ lastWatchFileSet = watchResult.watchFileSet;
96
108
  });
97
109
  }
98
110
 
@@ -102,10 +114,6 @@ export class SdClientBuildRunner extends EventEmitter {
102
114
  buildMessages: ISdBuildMessage[];
103
115
  emitFileSet: Set<TNormPath>;
104
116
  }> {
105
- const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {}).mapMany((key) =>
106
- FsUtil.glob(path.resolve(this._pkgPath, "../../node_modules", key)),
107
- );
108
-
109
117
  const ngBundlerBuilderTypes = Object.keys(this._pkgConf.builder ?? { web: {} }) as (
110
118
  | "web"
111
119
  | "electron"
@@ -142,9 +150,7 @@ export class SdClientBuildRunner extends EventEmitter {
142
150
  ...this._pkgConf.builder?.[ngBundlerBuilderType]?.env,
143
151
  },
144
152
  cordovaConfig: ngBundlerBuilderType === "cordova" ? this._pkgConf.builder!.cordova : undefined,
145
- watchScopePaths: [path.resolve(this._pkgPath, "../"), ...localUpdatePaths].map((item) =>
146
- PathUtil.norm(item),
147
- ),
153
+ watchScopePaths: Array.from(this._watchScopePathSet),
148
154
  }),
149
155
  );
150
156
  }
@@ -170,15 +176,13 @@ export class SdClientBuildRunner extends EventEmitter {
170
176
  }
171
177
 
172
178
  this._debug(`빌드 완료`);
173
- const currWatchFileSet = new Set(
174
- Array.from(watchFileSet).filter(
175
- (item) =>
176
- PathUtil.isChildPath(item, path.resolve(this._pkgPath, "../")) ||
177
- localUpdatePaths.some((lu) => PathUtil.isChildPath(item, lu)),
179
+ /*const currWatchFileSet = new Set(
180
+ Array.from(watchFileSet).filter((item) =>
181
+ Array.from(this._watchScopePathSet).some((scope) => PathUtil.isChildPath(item, scope)),
178
182
  ),
179
- );
183
+ );*/
180
184
  return {
181
- watchFileSet: currWatchFileSet,
185
+ watchFileSet,
182
186
  affectedFileSet,
183
187
  buildMessages: results, //.filter((item) => item.filePath !== path.resolve(this._pkgPath, "src/routes.ts")),
184
188
  emitFileSet,
@@ -242,6 +242,7 @@ export class SdNgBundler {
242
242
  watchFileSet: new Set([
243
243
  ...this.#ngResultCache.watchFileSet!,
244
244
  ...this.#styleLoadResultCache.watchFiles.map((item) => PathUtil.norm(item)),
245
+ ...assetFiles.map((item) => PathUtil.norm(item.source)),
245
246
  PathUtil.norm(this.#indexHtmlFilePath),
246
247
  ]),
247
248
  affectedFileSet: this.#ngResultCache.affectedFileSet!,
@@ -7,7 +7,7 @@ import { SdCliPerformanceTimer } from "../../utils/SdCliPerformanceTime";
7
7
  import { SdCliConvertMessageUtil } from "../../utils/SdCliConvertMessageUtil";
8
8
  import { ISdCliNgPluginResultCache } from "../../types/build-plugin.type";
9
9
  import { ISdTsCompilerResult } from "../../types/ts-compiler.type";
10
- import { SdTsCompileWorker } from "../../ts-builder/SdTsCompileWorker";
10
+ import { SdTsCompiler } from "../../ts-builder/SdTsCompiler";
11
11
 
12
12
  export function createSdNgPlugin(conf: {
13
13
  pkgPath: TNormPath;
@@ -25,8 +25,8 @@ export function createSdNgPlugin(conf: {
25
25
 
26
26
  return {
27
27
  name: "sd-ng-compile",
28
- setup: async (build: esbuild.PluginBuild) => {
29
- const tsCompiler = await SdTsCompileWorker.new({
28
+ setup: (build: esbuild.PluginBuild) => {
29
+ const tsCompiler = new SdTsCompiler({
30
30
  pkgPath: conf.pkgPath,
31
31
  additionalOptions: { declaration: false },
32
32
  isDevMode: conf.dev,