@simplysm/sd-cli 11.1.45 → 11.1.46

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 (48) hide show
  1. package/dist/build-cluster.js +16 -3
  2. package/dist/build-cluster.js.map +1 -1
  3. package/dist/build-tools/SdNgBundler.d.ts +1 -1
  4. package/dist/build-tools/SdNgBundler.js +4 -1
  5. package/dist/build-tools/SdNgBundler.js.map +1 -1
  6. package/dist/build-tools/SdServerBundler.js.map +1 -1
  7. package/dist/build-tools/SdTsCompiler.d.ts +5 -21
  8. package/dist/build-tools/SdTsCompiler.js +211 -188
  9. package/dist/build-tools/SdTsCompiler.js.map +1 -1
  10. package/dist/build-tools2/SdTsCompiler2.d.ts +26 -0
  11. package/dist/build-tools2/SdTsCompiler2.js +280 -0
  12. package/dist/build-tools2/SdTsCompiler2.js.map +1 -0
  13. package/dist/builders/SdCliTsLibBuilder.js +6 -11
  14. package/dist/builders/SdCliTsLibBuilder.js.map +1 -1
  15. package/dist/bundle-plugins/sdNgPlugin.d.ts +3 -3
  16. package/dist/bundle-plugins/sdNgPlugin.js +22 -212
  17. package/dist/bundle-plugins/sdNgPlugin.js.map +1 -1
  18. package/dist/bundle-plugins/sdServerPlugin.d.ts +2 -2
  19. package/dist/bundle-plugins/sdServerPlugin.js +17 -110
  20. package/dist/bundle-plugins/sdServerPlugin.js.map +1 -1
  21. package/dist/commons.d.ts +1 -0
  22. package/dist/entry/SdCliProject.d.ts +1 -0
  23. package/dist/entry/SdCliProject.js +11 -29
  24. package/dist/entry/SdCliProject.js.map +1 -1
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +1 -0
  27. package/dist/index.js.map +1 -1
  28. package/dist/sd-cli.js +7 -1
  29. package/dist/sd-cli.js.map +1 -1
  30. package/dist/server-worker.js.map +1 -1
  31. package/dist/utils/SdCliBuildResultUtil.d.ts +10 -0
  32. package/dist/utils/SdCliBuildResultUtil.js +17 -1
  33. package/dist/utils/SdCliBuildResultUtil.js.map +1 -1
  34. package/package.json +15 -15
  35. package/src/build-cluster.ts +18 -4
  36. package/src/build-tools/SdNgBundler.ts +7 -4
  37. package/src/build-tools/SdServerBundler.ts +2 -2
  38. package/src/build-tools/SdTsCompiler.ts +64 -94
  39. package/src/build-tools2/SdTsCompiler2.ts +427 -0
  40. package/src/builders/SdCliTsLibBuilder.ts +6 -11
  41. package/src/bundle-plugins/sdNgPlugin.ts +26 -320
  42. package/src/bundle-plugins/sdServerPlugin.ts +20 -168
  43. package/src/commons.ts +1 -0
  44. package/src/entry/SdCliProject.ts +12 -30
  45. package/src/index.ts +1 -0
  46. package/src/sd-cli.ts +7 -1
  47. package/src/server-worker.ts +3 -3
  48. package/src/utils/SdCliBuildResultUtil.ts +22 -3
@@ -2,7 +2,6 @@ import path from "path";
2
2
  import {FsUtil, Logger, PathUtil, SdProcess} from "@simplysm/sd-core-node";
3
3
  import {
4
4
  INpmConfig,
5
- ISdCliBuildClusterReqMessage,
6
5
  ISdCliBuildClusterResMessage,
7
6
  ISdCliConfig,
8
7
  ISdCliPackageBuildResult,
@@ -23,6 +22,7 @@ export class SdCliProject {
23
22
  confFileRelPath: string;
24
23
  optNames: string[];
25
24
  pkgNames: string[];
25
+ inspectNames: string[];
26
26
  }): Promise<void> {
27
27
  const logger = Logger.get(["simplysm", "sd-cli", "SdCliProject", "watchAsync"]);
28
28
 
@@ -220,16 +220,7 @@ export class SdCliProject {
220
220
  logger.log("빌드를 시작합니다...");
221
221
 
222
222
  await pkgPaths.parallelAsync(async (pkgPath) => {
223
- const pkgConf = projConf.packages[path.basename(pkgPath)]!;
224
- if (pkgConf.type === "client") {
225
- const builderKeys = Object.keys(pkgConf.builder ?? {web: {}});
226
- await builderKeys.parallelAsync(async (builderKey) => {
227
- await this._runCommandAsync(cluster, "watch", projConf, pkgPath, builderKey);
228
- });
229
- }
230
- else {
231
- await this._runCommandAsync(cluster, "watch", projConf, pkgPath);
232
- }
223
+ await this._runCommandAsync(cluster, "watch", projConf, pkgPath, opt.inspectNames.includes(path.basename(pkgPath)) ? ["--inspect"] : []);
233
224
  });
234
225
 
235
226
  busyReqCntMap.set(
@@ -274,7 +265,7 @@ export class SdCliProject {
274
265
  logger.debug("빌드 프로세스 명령 전달...");
275
266
  const results = (
276
267
  await pkgPaths.parallelAsync(async (pkgPath) => {
277
- const pkgConf = projConf.packages[path.basename(pkgPath)]!;
268
+ /*const pkgConf = projConf.packages[path.basename(pkgPath)]!;
278
269
  if (pkgConf.type === "client") {
279
270
  const builderKeys = Object.keys(pkgConf.builder ?? {web: {}});
280
271
  return (await builderKeys.parallelAsync(async (builderKey) => {
@@ -282,8 +273,8 @@ export class SdCliProject {
282
273
  })).mapMany();
283
274
  }
284
275
  else {
285
- return await this._runCommandAsync(cluster, "build", projConf, pkgPath);
286
- }
276
+ }*/
277
+ return await this._runCommandAsync(cluster, "build", projConf, pkgPath);
287
278
  })
288
279
  ).mapMany();
289
280
 
@@ -342,16 +333,7 @@ export class SdCliProject {
342
333
  logger.debug("빌드 프로세스 명령 전달...");
343
334
  const results = (
344
335
  await pkgPaths.parallelAsync(async (pkgPath) => {
345
- const pkgConf = projConf.packages[path.basename(pkgPath)]!;
346
- if (pkgConf.type === "client") {
347
- const builderKeys = Object.keys(pkgConf.builder ?? {web: {}});
348
- return (await builderKeys.parallelAsync(async (builderKey) => {
349
- return await this._runCommandAsync(cluster, "build", projConf, pkgPath, builderKey);
350
- })).mapMany();
351
- }
352
- else {
353
- return await this._runCommandAsync(cluster, "build", projConf, pkgPath);
354
- }
336
+ return await this._runCommandAsync(cluster, "build", projConf, pkgPath);
355
337
  })
356
338
  ).mapMany();
357
339
 
@@ -577,9 +559,9 @@ export class SdCliProject {
577
559
  });
578
560
  }
579
561
 
580
- private static async _runCommandAsync(cluster: cp.ChildProcess, cmd: "watch", projConf: ISdCliConfig, pkgPath: string, builderKey?: string): Promise<void>;
581
- private static async _runCommandAsync(cluster: cp.ChildProcess, cmd: "build", projConf: ISdCliConfig, pkgPath: string, builderKey?: string): Promise<ISdCliPackageBuildResult[]>;
582
- private static async _runCommandAsync(cluster: cp.ChildProcess, cmd: "watch" | "build", projConf: ISdCliConfig, pkgPath: string, builderKey?: string): Promise<ISdCliPackageBuildResult[] | void> {
562
+ private static async _runCommandAsync(cluster: cp.ChildProcess, cmd: "watch", projConf: ISdCliConfig, pkgPath: string, execArgs: string[]): Promise<void>;
563
+ private static async _runCommandAsync(cluster: cp.ChildProcess, cmd: "build", projConf: ISdCliConfig, pkgPath: string): Promise<ISdCliPackageBuildResult[]>;
564
+ private static async _runCommandAsync(cluster: cp.ChildProcess, cmd: "watch" | "build", projConf: ISdCliConfig, pkgPath: string, execArgs?: string[]): Promise<ISdCliPackageBuildResult[] | void> {
583
565
  return await new Promise<ISdCliPackageBuildResult[] | void>((resolve) => {
584
566
  const cb = (message: ISdCliBuildClusterResMessage): void => {
585
567
  if (cmd === "watch" && message.type === "ready" && message.req.cmd === cmd && message.req.pkgPath === pkgPath) {
@@ -597,8 +579,8 @@ export class SdCliProject {
597
579
  cmd,
598
580
  projConf,
599
581
  pkgPath,
600
- builderKey
601
- } as ISdCliBuildClusterReqMessage);
582
+ execArgs
583
+ });
602
584
  });
603
585
  }
604
586
 
@@ -667,4 +649,4 @@ export class SdCliProject {
667
649
  });
668
650
  });
669
651
  }
670
- }
652
+ }
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ export * from "./build-tools/SdNgBundler";
6
6
  export * from "./build-tools/SdNgBundlerContext";
7
7
  export * from "./build-tools/SdServerBundler";
8
8
  export * from "./build-tools/SdTsCompiler";
9
+ export * from "./build-tools2/SdTsCompiler2";
9
10
  export * from "./builders/SdCliClientBuilder";
10
11
  export * from "./builders/SdCliJsLibLinter";
11
12
  export * from "./builders/SdCliServerBuilder";
package/src/sd-cli.ts CHANGED
@@ -57,6 +57,11 @@ const argv = (
57
57
  string: true,
58
58
  array: true,
59
59
  describe: "수행할 패키지 설정"
60
+ },
61
+ inspects: {
62
+ string: true,
63
+ array: true,
64
+ describe: "크롬 inspect를 수행할 패키지 설정"
60
65
  }
61
66
  })
62
67
  )
@@ -197,7 +202,8 @@ else if (argv._[0] === "watch") {
197
202
  .watchAsync({
198
203
  confFileRelPath: argv.config ?? "simplysm.cjs",
199
204
  optNames: argv.options ?? [],
200
- pkgNames: argv.packages ?? []
205
+ pkgNames: argv.packages ?? [],
206
+ inspectNames: argv.inspects ?? []
201
207
  });
202
208
  }
203
209
  else if (argv._[0] === "build") {
@@ -52,14 +52,14 @@ else {
52
52
 
53
53
 
54
54
  server.on("ready", () => {
55
- process.send!({port: server!.options.port});
55
+ process.send!({port: server.options.port});
56
56
  });
57
57
 
58
58
  process.on("message", (message: any) => {
59
59
  if (message.type === "setPathProxy") {
60
- server!.pathProxy = message.pathProxy;
60
+ server.pathProxy = message.pathProxy;
61
61
  }
62
62
  if (message.type === "broadcastReload") {
63
- server!.broadcastReload();
63
+ server.broadcastReload();
64
64
  }
65
65
  });
@@ -2,9 +2,10 @@ import ts from "typescript";
2
2
  import os from "os";
3
3
  import path from "path";
4
4
  import {ISdCliPackageBuildResult} from "../commons";
5
+ import {PartialMessage} from "esbuild";
5
6
 
6
7
  export class SdCliBuildResultUtil {
7
- public static convertFromTsDiag(diag: ts.Diagnostic, type: "build" | "check"): ISdCliPackageBuildResult {
8
+ static convertFromTsDiag(diag: ts.Diagnostic, type: "build" | "check"): ISdCliPackageBuildResult {
8
9
  const severity = diag.category === ts.DiagnosticCategory.Error ? "error" as const
9
10
  : diag.category === ts.DiagnosticCategory.Warning ? "warning" as const
10
11
  : diag.category === ts.DiagnosticCategory.Suggestion ? "suggestion" as const
@@ -19,7 +20,7 @@ export class SdCliBuildResultUtil {
19
20
  const char = position ? position.character + 1 : undefined;
20
21
 
21
22
  return {
22
- filePath: filePath !== undefined ? path.resolve(filePath) : undefined,
23
+ filePath,
23
24
  line,
24
25
  char,
25
26
  code,
@@ -29,7 +30,25 @@ export class SdCliBuildResultUtil {
29
30
  };
30
31
  }
31
32
 
32
- public static getMessage(result: ISdCliPackageBuildResult): string {
33
+ static convertFromEsbuildResult(msg: PartialMessage, type: "build" | "check", severity: "warning" | "error") {
34
+ const filePath = msg.location?.file != null ? path.resolve(msg.location.file) : undefined;
35
+ const line = msg.location?.line;
36
+ const char = msg.location?.column;
37
+ const code = msg.text?.slice(0, msg.text.indexOf(":"));
38
+ const message = `${msg.pluginName != null ? `(${msg.pluginName}) ` : ""} ${msg.text?.slice(msg.text.indexOf(":") + 1)}`;
39
+
40
+ return {
41
+ filePath,
42
+ line,
43
+ char,
44
+ code,
45
+ severity,
46
+ message,
47
+ type
48
+ };
49
+ }
50
+
51
+ static getMessage(result: ISdCliPackageBuildResult): string {
33
52
  let str = "";
34
53
  if (result.filePath !== undefined) {
35
54
  str += `${result.filePath}(${result.line ?? 0}, ${result.char ?? 0}): `;