@simplysm/sd-cli 12.7.3 → 12.7.5

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 (100) hide show
  1. package/dist/entry/SdAiCommand.d.ts +1 -1
  2. package/dist/entry/SdAiCommand.js +9 -4
  3. package/dist/entry/SdAiCommand.js.map +1 -1
  4. package/dist/entry/SdCliCordova.d.ts +1 -1
  5. package/dist/entry/SdCliCordova.js +2 -0
  6. package/dist/entry/SdCliCordova.js.map +1 -1
  7. package/dist/entry/SdCliElectron.d.ts +1 -1
  8. package/dist/entry/SdCliElectron.js +2 -0
  9. package/dist/entry/SdCliElectron.js.map +1 -1
  10. package/dist/entry/SdCliLocalUpdate.js +1 -0
  11. package/dist/entry/SdCliLocalUpdate.js.map +1 -1
  12. package/dist/entry/SdCliProject.js +3 -0
  13. package/dist/entry/SdCliProject.js.map +1 -1
  14. package/dist/pkg-builders/SdMultiBuildRunner.d.ts +2 -2
  15. package/dist/pkg-builders/SdMultiBuildRunner.js +5 -0
  16. package/dist/pkg-builders/SdMultiBuildRunner.js.map +1 -1
  17. package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js +3 -2
  18. package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js.map +1 -1
  19. package/dist/pkg-builders/client/SdClientBuildRunner.d.ts +3 -3
  20. package/dist/pkg-builders/client/SdClientBuildRunner.js +3 -0
  21. package/dist/pkg-builders/client/SdClientBuildRunner.js.map +1 -1
  22. package/dist/pkg-builders/client/SdNgBundler.d.ts +3 -3
  23. package/dist/pkg-builders/client/SdNgBundler.js +6 -65
  24. package/dist/pkg-builders/client/SdNgBundler.js.map +1 -1
  25. package/dist/pkg-builders/client/createSdNgPlugin.d.ts +2 -2
  26. package/dist/pkg-builders/client/createSdNgPlugin.js +3 -0
  27. package/dist/pkg-builders/client/createSdNgPlugin.js.map +1 -1
  28. package/dist/pkg-builders/lib/SdJsLibBuildRunner.d.ts +2 -2
  29. package/dist/pkg-builders/lib/SdJsLibBuildRunner.js +3 -0
  30. package/dist/pkg-builders/lib/SdJsLibBuildRunner.js.map +1 -1
  31. package/dist/pkg-builders/lib/SdTsLibBuildRunner.d.ts +2 -2
  32. package/dist/pkg-builders/lib/SdTsLibBuildRunner.js +2 -0
  33. package/dist/pkg-builders/lib/SdTsLibBuildRunner.js.map +1 -1
  34. package/dist/pkg-builders/lib/SdTsLibBuilder.d.ts +2 -2
  35. package/dist/pkg-builders/lib/SdTsLibBuilder.js +1 -0
  36. package/dist/pkg-builders/lib/SdTsLibBuilder.js.map +1 -1
  37. package/dist/pkg-builders/server/SdServerBuildRunner.d.ts +3 -3
  38. package/dist/pkg-builders/server/SdServerBuildRunner.js +3 -0
  39. package/dist/pkg-builders/server/SdServerBuildRunner.js.map +1 -1
  40. package/dist/pkg-builders/server/SdServerBundler.d.ts +2 -2
  41. package/dist/pkg-builders/server/SdServerBundler.js +2 -0
  42. package/dist/pkg-builders/server/SdServerBundler.js.map +1 -1
  43. package/dist/pkg-builders/server/createSdServerPlugin.d.ts +2 -2
  44. package/dist/pkg-builders/server/createSdServerPlugin.js +3 -0
  45. package/dist/pkg-builders/server/createSdServerPlugin.js.map +1 -1
  46. package/dist/sd-cli.js +1 -1
  47. package/dist/sd-cli.js.map +1 -1
  48. package/dist/ts-builder/SdTsCompiler.d.ts +2 -2
  49. package/dist/ts-builder/SdTsCompiler.js +16 -9
  50. package/dist/ts-builder/SdTsCompiler.js.map +1 -1
  51. package/dist/types/build-plugin.type.d.ts +1 -1
  52. package/dist/types/build-plugin.type.js +2 -1
  53. package/dist/types/build-plugin.type.js.map +1 -1
  54. package/dist/types/build-runner.type.d.ts +2 -2
  55. package/dist/types/build-runner.type.js +2 -1
  56. package/dist/types/build-runner.type.js.map +1 -1
  57. package/dist/types/build.type.d.ts +1 -1
  58. package/dist/types/build.type.js +1 -1
  59. package/dist/types/build.type.js.map +1 -1
  60. package/dist/types/ts-compiler.type.d.ts +3 -3
  61. package/dist/types/ts-compiler.type.js +4 -1
  62. package/dist/types/ts-compiler.type.js.map +1 -1
  63. package/dist/types/workers.type.d.ts +2 -2
  64. package/dist/types/workers.type.js +2 -1
  65. package/dist/types/workers.type.js.map +1 -1
  66. package/dist/utils/SdCliConvertMessageUtil.d.ts +2 -2
  67. package/dist/utils/SdCliConvertMessageUtil.js +3 -0
  68. package/dist/utils/SdCliConvertMessageUtil.js.map +1 -1
  69. package/dist/workers/build-runner-worker.js +3 -0
  70. package/dist/workers/build-runner-worker.js.map +1 -1
  71. package/dist/workers/server-worker.js +1 -0
  72. package/dist/workers/server-worker.js.map +1 -1
  73. package/package.json +7 -7
  74. package/src/entry/SdAiCommand.ts +14 -4
  75. package/src/entry/SdCliCordova.ts +2 -2
  76. package/src/entry/SdCliElectron.ts +2 -2
  77. package/src/entry/SdCliLocalUpdate.ts +1 -1
  78. package/src/entry/SdCliProject.ts +3 -3
  79. package/src/pkg-builders/SdMultiBuildRunner.ts +6 -6
  80. package/src/pkg-builders/client/SdCliNgRoutesFileGenerator.ts +6 -4
  81. package/src/pkg-builders/client/SdClientBuildRunner.ts +4 -4
  82. package/src/pkg-builders/client/SdNgBundler.ts +11 -76
  83. package/src/pkg-builders/client/createSdNgPlugin.ts +3 -3
  84. package/src/pkg-builders/lib/SdJsLibBuildRunner.ts +2 -2
  85. package/src/pkg-builders/lib/SdTsLibBuildRunner.ts +3 -3
  86. package/src/pkg-builders/lib/SdTsLibBuilder.ts +2 -2
  87. package/src/pkg-builders/server/SdServerBuildRunner.ts +4 -4
  88. package/src/pkg-builders/server/SdServerBundler.ts +4 -4
  89. package/src/pkg-builders/server/createSdServerPlugin.ts +3 -3
  90. package/src/sd-cli.ts +1 -1
  91. package/src/ts-builder/SdTsCompiler.ts +99 -31
  92. package/src/types/build-plugin.type.ts +1 -1
  93. package/src/types/build-runner.type.ts +2 -2
  94. package/src/types/build.type.ts +1 -1
  95. package/src/types/ts-compiler.type.ts +3 -3
  96. package/src/types/workers.type.ts +2 -2
  97. package/src/utils/SdCliConvertMessageUtil.ts +2 -2
  98. package/src/workers/build-runner-worker.ts +3 -3
  99. package/src/workers/server-worker.ts +1 -1
  100. package/tsconfig.json +2 -1
@@ -1,6 +1,6 @@
1
1
  import path from "path";
2
- import esbuild, { Metafile } from "esbuild";
3
- import { FsUtil, Logger, PathUtil, TNormPath } from "@simplysm/sd-core-node";
2
+ import esbuild, { type Metafile } from "esbuild";
3
+ import { FsUtil, Logger, PathUtil, type TNormPath } from "@simplysm/sd-core-node";
4
4
  import { fileURLToPath } from "url";
5
5
  import nodeStdLibBrowser from "node-stdlib-browser";
6
6
  import nodeStdLibBrowserPlugin from "node-stdlib-browser/helpers/esbuild/plugin";
@@ -13,17 +13,17 @@ import {
13
13
  transformSupportedBrowsersToTargets,
14
14
  } from "@angular/build/src/tools/esbuild/utils";
15
15
  import {
16
- BuildOutputFile,
16
+ type BuildOutputFile,
17
17
  BuildOutputFileType,
18
- InitialFileRecord,
18
+ type InitialFileRecord,
19
19
  } from "@angular/build/src/tools/esbuild/bundler-context";
20
20
  import { extractLicenses } from "@angular/build/src/tools/esbuild/license-extractor";
21
21
  import {
22
- HintMode,
22
+ type HintMode,
23
23
  IndexHtmlGenerator,
24
- IndexHtmlProcessResult,
24
+ type IndexHtmlProcessResult,
25
25
  } from "@angular/build/src/utils/index-file/index-html-generator";
26
- import { Entrypoint } from "@angular/build/src/utils/index-file/augment-index-html";
26
+ import { type Entrypoint } from "@angular/build/src/utils/index-file/augment-index-html";
27
27
  import { CrossOrigin } from "@angular/build/src/builders/application/schema";
28
28
  import { augmentAppWithServiceWorkerEsbuild } from "@angular/build/src/utils/service-worker";
29
29
  import { createSourcemapIgnorelistPlugin } from "@angular/build/src/tools/esbuild/sourcemap-ignorelist-plugin";
@@ -34,10 +34,10 @@ import { createCssResourcePlugin } from "@angular/build/src/tools/esbuild/styles
34
34
  import { resolveAssets } from "@angular/build/src/utils/resolve-assets";
35
35
  import { createSdNgPlugin } from "./createSdNgPlugin";
36
36
  import { SdCliPerformanceTimer } from "../../utils/SdCliPerformanceTime";
37
- import { INpmConfig } from "../../types/common-configs.type";
38
- import { ISdClientBuilderCordovaConfig } from "../../types/sd-configs.type";
39
- import { ISdCliNgPluginResultCache } from "../../types/build-plugin.type";
40
- import { ISdBuildMessage } from "../../types/build.type";
37
+ import { type INpmConfig } from "../../types/common-configs.type";
38
+ import { type ISdClientBuilderCordovaConfig } from "../../types/sd-configs.type";
39
+ import { type ISdCliNgPluginResultCache } from "../../types/build-plugin.type";
40
+ import { type ISdBuildMessage } from "../../types/build.type";
41
41
  import nodeModule from "node:module";
42
42
 
43
43
  export class SdNgBundler {
@@ -435,7 +435,6 @@ export class SdNgBundler {
435
435
  entryNames: "[dir]/[name]",
436
436
  entryPoints: {
437
437
  main: this.#mainFilePath,
438
- // polyfills: 'angular:polyfills',
439
438
  // TODO: Polyfills Bundler 분리
440
439
  polyfills: path.resolve(this._opt.pkgPath, "src/polyfills.ts"),
441
440
  ...(this._opt.builderType === "cordova"
@@ -492,29 +491,6 @@ export class SdNgBundler {
492
491
  inject: [PathUtil.posix(fileURLToPath(import.meta.resolve("node-stdlib-browser/helpers/esbuild/shim")))],
493
492
  }),
494
493
  plugins: [
495
- /*...(this._opt.builderType === "cordova" && this._opt.cordovaConfig?.plugins
496
- ? [
497
- {
498
- name: "cordova:plugin-empty",
499
- setup: ({ onResolve }) => {
500
- onResolve({ filter: new RegExp("(" + this._opt.cordovaConfig!.plugins!.join("|") + ")") }, () => {
501
- return {
502
- path: `./cordova-empty.js`,
503
- external: true,
504
- };
505
- });
506
- },
507
- },
508
- ]
509
- : []),*/
510
- // createVirtualModulePlugin({
511
- // namespace: "angular:polyfills",
512
- // loadContent: () => ({
513
- // contents: `import "./src/polyfills.ts";`,
514
- // loader: 'js',
515
- // resolveDir: this._opt.pkgPath
516
- // })
517
- // }) as esbuild.Plugin,
518
494
  createSourcemapIgnorelistPlugin(),
519
495
  createSdNgPlugin({
520
496
  modifiedFileSet: this.#modifiedFileSet,
@@ -523,38 +499,7 @@ export class SdNgBundler {
523
499
  result: this.#ngResultCache,
524
500
  watchScopePaths: this._opt.watchScopePaths,
525
501
  }),
526
- // createCompilerPlugin({
527
- // sourcemap: this._opt.dev,
528
- // tsconfig: this._tsConfigFilePath,
529
- // jit: false,
530
- // advancedOptimizations: true,
531
- // thirdPartySourcemaps: false,
532
- // fileReplacements: undefined,
533
- // sourceFileCache: this._sourceFileCache,
534
- // loadResultCache: this._sourceFileCache.loadResultCache,
535
- // incremental: this._opt.dev
536
- // }, {
537
- // workspaceRoot: this._opt.pkgPath,
538
- // optimization: !this._opt.dev,
539
- // sourcemap: this._opt.dev ? 'inline' : false,
540
- // outputNames: {bundles: '[name]', media: 'media/[name]'},
541
- // includePaths: [],
542
- // externalDependencies: [],
543
- // target: this._browserTarget,
544
- // inlineStyleLanguage: 'scss',
545
- // preserveSymlinks: false,
546
- // tailwindConfiguration: undefined
547
- // }) as esbuild.Plugin,
548
502
  ...(this._opt.builderType === "electron" ? [] : [nodeStdLibBrowserPlugin(nodeStdLibBrowser)]),
549
- // {
550
- // name: "sd-load-file",
551
- // setup: ({onLoad}) => {
552
- // onLoad({filter: /.*/}, (args) => {
553
- // this.#loadFilePathSet.add(args.path);
554
- // return null;
555
- // });
556
- // }
557
- // }
558
503
  ],
559
504
  });
560
505
  }
@@ -587,19 +532,9 @@ export class SdNgBundler {
587
532
  mainFields: ["style", "sass"],
588
533
  legalComments: !this._opt.dev ? "none" : "eof",
589
534
  entryPoints: {
590
- // styles: 'angular:styles/global;styles'
591
535
  styles: path.resolve(this._opt.pkgPath, "src/styles.scss"),
592
536
  },
593
537
  plugins: [
594
- // createVirtualModulePlugin({
595
- // namespace: "angular:styles/global",
596
- // transformPath: (currPath) => currPath.split(';', 2)[1],
597
- // loadContent: () => ({
598
- // contents: `@import 'src/styles.scss';`,
599
- // loader: 'css',
600
- // resolveDir: this._opt.pkgPath
601
- // }),
602
- // }) as esbuild.Plugin,
603
538
  pluginFactory.create(SassStylesheetLanguage),
604
539
  pluginFactory.create(CssStylesheetLanguage),
605
540
  createCssResourcePlugin(this.#styleLoadResultCache),
@@ -2,11 +2,11 @@ import esbuild from "esbuild";
2
2
  import path from "path";
3
3
  import os from "os";
4
4
  import { JavaScriptTransformer } from "@angular/build/src/tools/esbuild/javascript-transformer";
5
- import { Logger, PathUtil, TNormPath } from "@simplysm/sd-core-node";
5
+ import { Logger, PathUtil, type TNormPath } from "@simplysm/sd-core-node";
6
6
  import { SdCliPerformanceTimer } from "../../utils/SdCliPerformanceTime";
7
7
  import { SdCliConvertMessageUtil } from "../../utils/SdCliConvertMessageUtil";
8
- import { ISdCliNgPluginResultCache } from "../../types/build-plugin.type";
9
- import { ISdTsCompilerResult } from "../../types/ts-compiler.type";
8
+ import { type ISdCliNgPluginResultCache } from "../../types/build-plugin.type";
9
+ import { type ISdTsCompilerResult } from "../../types/ts-compiler.type";
10
10
  import { SdTsCompiler } from "../../ts-builder/SdTsCompiler";
11
11
 
12
12
  export function createSdNgPlugin(conf: {
@@ -3,8 +3,8 @@ import path from "path";
3
3
  import { EventEmitter } from "events";
4
4
  import { SdCliConvertMessageUtil } from "../../utils/SdCliConvertMessageUtil";
5
5
  // import { TSdLintWorkerType } from "../../types/workers.type";
6
- import { ISdProjectConfig } from "../../types/sd-configs.type";
7
- import { ISdBuildRunnerResult } from "../../types/build.type";
6
+ import { type ISdProjectConfig } from "../../types/sd-configs.type";
7
+ import { type ISdBuildRunnerResult } from "../../types/build.type";
8
8
  import { ESLint } from "eslint";
9
9
 
10
10
  export class SdJsLibBuildRunner extends EventEmitter {
@@ -1,10 +1,10 @@
1
- import { FsUtil, Logger, PathUtil, SdFsWatcher, TNormPath } from "@simplysm/sd-core-node";
1
+ import { FsUtil, Logger, PathUtil, SdFsWatcher, type TNormPath } from "@simplysm/sd-core-node";
2
2
  import path from "path";
3
3
  import { EventEmitter } from "events";
4
4
  import { SdCliIndexFileGenerator } from "./SdCliIndexFileGenerator";
5
5
  import { SdTsLibBuilder } from "./SdTsLibBuilder";
6
- import { ISdLibPackageConfig, ISdProjectConfig } from "../../types/sd-configs.type";
7
- import { ISdBuildMessage, ISdBuildRunnerResult } from "../../types/build.type";
6
+ import { type ISdLibPackageConfig, type ISdProjectConfig } from "../../types/sd-configs.type";
7
+ import { type ISdBuildMessage, type ISdBuildRunnerResult } from "../../types/build.type";
8
8
 
9
9
  export class SdTsLibBuildRunner extends EventEmitter {
10
10
  private _logger = Logger.get(["simplysm", "sd-cli", "SdCliTsLibBuilder"]);
@@ -1,7 +1,7 @@
1
1
  import path from "path";
2
2
  import { SdCliConvertMessageUtil } from "../../utils/SdCliConvertMessageUtil";
3
- import { FsUtil, PathUtil, TNormPath } from "@simplysm/sd-core-node";
4
- import { ISdBuildMessage } from "../../types/build.type";
3
+ import { FsUtil, PathUtil, type TNormPath } from "@simplysm/sd-core-node";
4
+ import { type ISdBuildMessage } from "../../types/build.type";
5
5
  import { SdTsCompiler } from "../../ts-builder/SdTsCompiler";
6
6
 
7
7
  export class SdTsLibBuilder {
@@ -1,11 +1,11 @@
1
1
  import { EventEmitter } from "events";
2
- import { FsUtil, Logger, PathUtil, SdFsWatcher, TNormPath } from "@simplysm/sd-core-node";
2
+ import { FsUtil, Logger, PathUtil, SdFsWatcher, type TNormPath } from "@simplysm/sd-core-node";
3
3
  import path from "path";
4
4
  import { StringUtil } from "@simplysm/sd-core-common";
5
5
  import { SdServerBundler } from "./SdServerBundler";
6
- import { ISdProjectConfig, ISdServerPackageConfig } from "../../types/sd-configs.type";
7
- import { ISdBuildMessage, ISdBuildRunnerResult } from "../../types/build.type";
8
- import { INpmConfig, ITsConfig } from "../../types/common-configs.type";
6
+ import { type ISdProjectConfig, type ISdServerPackageConfig } from "../../types/sd-configs.type";
7
+ import { type ISdBuildMessage, type ISdBuildRunnerResult } from "../../types/build.type";
8
+ import { type INpmConfig, type ITsConfig } from "../../types/common-configs.type";
9
9
 
10
10
  export class SdServerBuildRunner extends EventEmitter {
11
11
  private _logger = Logger.get(["simplysm", "sd-cli", "SdCliServerBuildRunner"]);
@@ -1,11 +1,11 @@
1
1
  import esbuild from "esbuild";
2
2
  import path from "path";
3
- import { FsUtil, Logger, PathUtil, TNormPath } from "@simplysm/sd-core-node";
3
+ import { FsUtil, Logger, PathUtil, type TNormPath } from "@simplysm/sd-core-node";
4
4
  import { SdCliConvertMessageUtil } from "../../utils/SdCliConvertMessageUtil";
5
- import { ISdCliServerPluginResultCache } from "../../types/build-plugin.type";
6
- import { ISdBuildMessage } from "../../types/build.type";
5
+ import { type ISdCliServerPluginResultCache } from "../../types/build-plugin.type";
6
+ import { type ISdBuildMessage } from "../../types/build.type";
7
7
  import { createSdServerPlugin } from "./createSdServerPlugin";
8
- import { BuildOutputFile, BuildOutputFileType } from "@angular/build/src/tools/esbuild/bundler-context";
8
+ import { type BuildOutputFile, BuildOutputFileType } from "@angular/build/src/tools/esbuild/bundler-context";
9
9
  import { convertOutputFile } from "@angular/build/src/tools/esbuild/utils";
10
10
  import { resolveAssets } from "@angular/build/src/utils/resolve-assets";
11
11
 
@@ -1,8 +1,8 @@
1
1
  import esbuild from "esbuild";
2
2
  import { SdCliConvertMessageUtil } from "../../utils/SdCliConvertMessageUtil";
3
- import { ISdCliServerPluginResultCache } from "../../types/build-plugin.type";
4
- import { PathUtil, TNormPath } from "@simplysm/sd-core-node";
5
- import { ISdTsCompilerResult } from "../../types/ts-compiler.type";
3
+ import { type ISdCliServerPluginResultCache } from "../../types/build-plugin.type";
4
+ import { PathUtil, type TNormPath } from "@simplysm/sd-core-node";
5
+ import { type ISdTsCompilerResult } from "../../types/ts-compiler.type";
6
6
  import { SdTsCompiler } from "../../ts-builder/SdTsCompiler";
7
7
 
8
8
  export function createSdServerPlugin(conf: {
package/src/sd-cli.ts CHANGED
@@ -246,7 +246,7 @@ else if (argv._[0] === "run-cordova") {
246
246
  });
247
247
  }
248
248
  else if (argv._[0] === "commit") {
249
- await SdAiCommand.commitMessageAsync();
249
+ await SdAiCommand.commitAsync();
250
250
  }
251
251
  else {
252
252
  throw new Error(`명령어가 잘못 되었습니다.\n\t${argv._[0]}\n`);
@@ -1,18 +1,28 @@
1
1
  import ts from "typescript";
2
2
  import path from "path";
3
- import { FsUtil, Logger, PathUtil, TNormPath } from "@simplysm/sd-core-node";
3
+ import { FsUtil, Logger, PathUtil, type TNormPath } from "@simplysm/sd-core-node";
4
4
  import { StringUtil } from "@simplysm/sd-core-common";
5
5
  import { NgtscProgram, OptimizeFor } from "@angular/compiler-cli";
6
- import { ComponentStylesheetBundler } from "@angular/build/src/tools/esbuild/angular/component-stylesheets";
7
- import { AngularCompilerHost } from "@angular/build/src/tools/angular/angular-host";
6
+ import {
7
+ ComponentStylesheetBundler,
8
+ } from "@angular/build/src/tools/esbuild/angular/component-stylesheets";
9
+ import { type AngularCompilerHost } from "@angular/build/src/tools/angular/angular-host";
8
10
  import { transformSupportedBrowsersToTargets } from "@angular/build/src/tools/esbuild/utils";
9
11
  import browserslist from "browserslist";
10
- import { replaceBootstrap } from "@angular/build/src/tools/angular/transformers/jit-bootstrap-transformer";
12
+ import {
13
+ replaceBootstrap,
14
+ } from "@angular/build/src/tools/angular/transformers/jit-bootstrap-transformer";
11
15
  import { SdCliPerformanceTimer } from "../utils/SdCliPerformanceTime";
12
16
  import { SdCliConvertMessageUtil } from "../utils/SdCliConvertMessageUtil";
13
- import { ISdTsCompilerResult, IStylesheetBundlingResult, SdTsCompilerOptions } from "../types/ts-compiler.type";
14
- import { ISdBuildMessage } from "../types/build.type";
15
- import { createWorkerTransformer } from "@angular/build/src/tools/angular/transformers/web-worker-transformer";
17
+ import {
18
+ type ISdTsCompilerResult,
19
+ type IStylesheetBundlingResult,
20
+ type SdTsCompilerOptions,
21
+ } from "../types/ts-compiler.type";
22
+ import { type ISdBuildMessage } from "../types/build.type";
23
+ import {
24
+ createWorkerTransformer,
25
+ } from "@angular/build/src/tools/angular/transformers/web-worker-transformer";
16
26
  import { ESLint } from "eslint";
17
27
 
18
28
  export class SdTsCompiler {
@@ -77,7 +87,10 @@ export class SdTsCompiler {
77
87
  ...opt.additionalOptions,
78
88
  });
79
89
 
80
- this.#distPath = PathUtil.norm(this.#parsedTsconfig.options.outDir ?? path.resolve(opt.pkgPath, "dist"));
90
+ this.#distPath = PathUtil.norm(this.#parsedTsconfig.options.outDir ?? path.resolve(
91
+ opt.pkgPath,
92
+ "dist",
93
+ ));
81
94
 
82
95
  //-- compilerHost
83
96
 
@@ -180,7 +193,11 @@ export class SdTsCompiler {
180
193
  }
181
194
  }
182
195
 
183
- async #bundleStylesheetAsync(data: string, containingFile: TNormPath, resourceFile: TNormPath | null = null) {
196
+ async #bundleStylesheetAsync(
197
+ data: string,
198
+ containingFile: TNormPath,
199
+ resourceFile: TNormPath | null = null,
200
+ ) {
184
201
  // containingFile: 포함된 파일 (.ts)
185
202
  // resourceFile: 외부 리소스 파일 (styleUrls로 입력하지 않고 styles에 직접 입력한 경우 null)
186
203
  // referencedFiles: import한 외부 scss 파일 혹은 woff파일등 외부 파일
@@ -203,7 +220,8 @@ export class SdTsCompiler {
203
220
  }
204
221
 
205
222
  this.#watchFileSet.adds(
206
- ...Array.from(stylesheetResult.referencedFiles.values()).map((item) => PathUtil.norm(item)),
223
+ ...Array.from(stylesheetResult.referencedFiles.values())
224
+ .map((item) => PathUtil.norm(item)),
207
225
  );
208
226
  }
209
227
 
@@ -262,17 +280,16 @@ export class SdTsCompiler {
262
280
  this.#affectedFileSet.add(modifiedFile);
263
281
  this.#affectedFileSet.adds(...(this.#revDependencyCacheMap.get(modifiedFile) ?? []));
264
282
  this.#affectedFileSet.adds(...(this.#resourceDependencyCacheMap.get(modifiedFile) ?? []));
265
-
266
- this.#emittedFilesCacheMap.delete(modifiedFile);
267
283
  }
268
284
  });
269
285
 
270
286
  this.#debug(`invalidate & clear cache...`);
271
287
 
272
288
  this.#perf.run("invalidate & clear cache", () => {
273
- this.#stylesheetBundler?.invalidate(this.#modifiedFileSet);
289
+ this.#stylesheetBundler?.invalidate(this.#affectedFileSet);
274
290
 
275
291
  for (const affectedFile of this.#affectedFileSet) {
292
+ this.#emittedFilesCacheMap.delete(affectedFile);
276
293
  this.#sourceFileCacheMap.delete(affectedFile);
277
294
  this.#stylesheetBundlingResultMap.delete(affectedFile);
278
295
  this.#watchFileSet.delete(affectedFile);
@@ -340,7 +357,10 @@ export class SdTsCompiler {
340
357
  }[]
341
358
  >();
342
359
  for (const sf of sourceFileSet) {
343
- if (!this.#watchScopePaths.some((scopePath) => PathUtil.isChildPath(sf.fileName, scopePath))) {
360
+ if (!this.#watchScopePaths.some((scopePath) => PathUtil.isChildPath(
361
+ sf.fileName,
362
+ scopePath,
363
+ ))) {
344
364
  continue;
345
365
  }
346
366
 
@@ -351,7 +371,10 @@ export class SdTsCompiler {
351
371
  refs
352
372
  .filter((item) => "fileName" in item)
353
373
  .filter((item) =>
354
- this.#watchScopePaths.some((scopePath) => PathUtil.isChildPath(item.fileName, scopePath)),
374
+ this.#watchScopePaths.some((scopePath) => PathUtil.isChildPath(
375
+ item.fileName,
376
+ scopePath,
377
+ )),
355
378
  ),
356
379
  );
357
380
  }
@@ -375,15 +398,22 @@ export class SdTsCompiler {
375
398
  if (prevSet?.has(targetRefItem.fileName)) continue;
376
399
 
377
400
  result.add(targetRefItem.fileName);
378
- result.adds(...getAllDeps(targetRefItem.fileName, new Set<TNormPath>(prevSet).adds(...result)));
401
+ result.adds(...getAllDeps(
402
+ targetRefItem.fileName,
403
+ new Set<TNormPath>(prevSet).adds(...result),
404
+ ));
379
405
  }
380
406
  }
381
407
  else {
382
- for (const targetRefItem of targetDeps.filter((item) => item.exportName === dep.importName)) {
408
+ for (const targetRefItem of targetDeps.filter((item) => item.exportName
409
+ === dep.importName)) {
383
410
  if (prevSet?.has(targetRefItem.fileName)) continue;
384
411
 
385
412
  result.add(targetRefItem.fileName);
386
- result.adds(...getAllDeps(targetRefItem.fileName, new Set<TNormPath>(prevSet).adds(...result)));
413
+ result.adds(...getAllDeps(
414
+ targetRefItem.fileName,
415
+ new Set<TNormPath>(prevSet).adds(...result),
416
+ ));
387
417
  }
388
418
  }
389
419
  }
@@ -406,7 +436,10 @@ export class SdTsCompiler {
406
436
  }
407
437
 
408
438
  for (const dep of this.#ngProgram.compiler.getResourceDependencies(sf)) {
409
- const ref = this.#resourceDependencyCacheMap.getOrCreate(PathUtil.norm(dep), new Set<TNormPath>());
439
+ const ref = this.#resourceDependencyCacheMap.getOrCreate(
440
+ PathUtil.norm(dep),
441
+ new Set<TNormPath>(),
442
+ );
410
443
  ref.add(PathUtil.norm(sf.fileName));
411
444
  }
412
445
  }
@@ -418,7 +451,10 @@ export class SdTsCompiler {
418
451
 
419
452
  this.#perf.run("get affected (init)", () => {
420
453
  for (const sf of sourceFileSet) {
421
- if (!this.#watchScopePaths.some((scopePath) => PathUtil.isChildPath(sf.fileName, scopePath))) {
454
+ if (!this.#watchScopePaths.some((scopePath) => PathUtil.isChildPath(
455
+ sf.fileName,
456
+ scopePath,
457
+ ))) {
422
458
  continue;
423
459
  }
424
460
 
@@ -552,7 +588,10 @@ export class SdTsCompiler {
552
588
  }
553
589
 
554
590
  diagnostics.push(
555
- ...this.#ngProgram!.compiler.getDiagnosticsForFile(affectedSourceFile, OptimizeFor.WholeProgram),
591
+ ...this.#ngProgram!.compiler.getDiagnosticsForFile(
592
+ affectedSourceFile,
593
+ OptimizeFor.WholeProgram,
594
+ ),
556
595
  );
557
596
  });
558
597
  }
@@ -617,7 +656,14 @@ export class SdTsCompiler {
617
656
  sf,
618
657
  (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
619
658
  if (!sourceFiles || sourceFiles.length === 0) {
620
- this.#compilerHost.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
659
+ this.#compilerHost.writeFile(
660
+ fileName,
661
+ text,
662
+ writeByteOrderMark,
663
+ onError,
664
+ sourceFiles,
665
+ data,
666
+ );
621
667
  return;
622
668
  }
623
669
 
@@ -629,17 +675,24 @@ export class SdTsCompiler {
629
675
  this.#ngProgram.compiler.incrementalCompilation.recordSuccessfulEmit(sourceFile);
630
676
  }
631
677
 
632
- const emitFileInfoCaches = this.#emittedFilesCacheMap.getOrCreate(PathUtil.norm(sourceFile.fileName), []);
678
+ const emitFileInfoCaches = this.#emittedFilesCacheMap.getOrCreate(PathUtil.norm(
679
+ sourceFile.fileName), []);
633
680
 
634
681
  if (PathUtil.isChildPath(sourceFile.fileName, this.#pkgPath)) {
635
682
  let realFilePath = PathUtil.norm(fileName);
636
683
  let realText = text;
637
684
  if (
638
- PathUtil.isChildPath(realFilePath, path.resolve(this.#distPath, path.basename(this.#pkgPath), "src"))
685
+ PathUtil.isChildPath(
686
+ realFilePath,
687
+ path.resolve(this.#distPath, path.basename(this.#pkgPath), "src"),
688
+ )
639
689
  ) {
640
690
  realFilePath = PathUtil.norm(
641
691
  this.#distPath,
642
- path.relative(path.resolve(this.#distPath, path.basename(this.#pkgPath), "src"), realFilePath),
692
+ path.relative(
693
+ path.resolve(this.#distPath, path.basename(this.#pkgPath), "src"),
694
+ realFilePath,
695
+ ),
643
696
  );
644
697
 
645
698
  if (fileName.endsWith(".js.map")) {
@@ -678,12 +731,20 @@ export class SdTsCompiler {
678
731
 
679
732
  await this.#perf.run("bundle global style", async () => {
680
733
  const data = FsUtil.readFile(this.#globalStyleFilePath!);
681
- const contents = await this.#bundleStylesheetAsync(data, this.#globalStyleFilePath!, this.#globalStyleFilePath);
682
- const emitFileInfos = this.#emittedFilesCacheMap.getOrCreate(this.#globalStyleFilePath!, []);
734
+ const contents = await this.#bundleStylesheetAsync(
735
+ data,
736
+ this.#globalStyleFilePath!,
737
+ this.#globalStyleFilePath,
738
+ );
739
+ const emitFileInfos = this.#emittedFilesCacheMap.getOrCreate(
740
+ this.#globalStyleFilePath!,
741
+ [],
742
+ );
683
743
  emitFileInfos.push({
684
744
  outAbsPath: PathUtil.norm(
685
745
  this.#pkgPath,
686
- path.relative(path.resolve(this.#pkgPath, "src"), this.#globalStyleFilePath!).replace(/\.scss$/, ".css"),
746
+ path.relative(path.resolve(this.#pkgPath, "src"), this.#globalStyleFilePath!)
747
+ .replace(/\.scss$/, ".css"),
687
748
  ),
688
749
  text: contents,
689
750
  });
@@ -785,9 +846,13 @@ export class SdTsCompiler {
785
846
  else if (ts.isImportDeclaration(node)) {
786
847
  const moduleSymbol = tc.getSymbolAtLocation(node.moduleSpecifier);
787
848
  if (!moduleSymbol) {
788
- if (ts.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text.startsWith("./")) {
849
+ if (ts.isStringLiteral(node.moduleSpecifier)
850
+ && node.moduleSpecifier.text.startsWith("./")) {
789
851
  deps.push({
790
- fileName: PathUtil.norm(path.resolve(path.dirname(sf.fileName), node.moduleSpecifier.text + ".ts")),
852
+ fileName: PathUtil.norm(path.resolve(
853
+ path.dirname(sf.fileName),
854
+ node.moduleSpecifier.text + ".ts",
855
+ )),
791
856
  importName: "*",
792
857
  });
793
858
 
@@ -852,7 +917,10 @@ export class SdTsCompiler {
852
917
  const moduleSymbol = tc.getSymbolAtLocation(node.arguments[0]);
853
918
  if (!moduleSymbol) {
854
919
  deps.push({
855
- fileName: PathUtil.norm(path.resolve(path.dirname(sf.fileName), node.arguments[0].text + ".ts")),
920
+ fileName: PathUtil.norm(path.resolve(
921
+ path.dirname(sf.fileName),
922
+ node.arguments[0].text + ".ts",
923
+ )),
856
924
  importName: "*",
857
925
  });
858
926
 
@@ -1,5 +1,5 @@
1
1
  import esbuild from "esbuild";
2
- import { TNormPath } from "@simplysm/sd-core-node";
2
+ import { type TNormPath } from "@simplysm/sd-core-node";
3
3
 
4
4
  export interface ISdCliServerPluginResultCache {
5
5
  watchFileSet?: Set<TNormPath>;
@@ -1,5 +1,5 @@
1
- import { TNormPath } from "@simplysm/sd-core-node";
2
- import { ISdProjectConfig } from "./sd-configs.type";
1
+ import { type TNormPath } from "@simplysm/sd-core-node";
2
+ import { type ISdProjectConfig } from "./sd-configs.type";
3
3
 
4
4
  export interface ISdBuildRunnerWorkerRequest {
5
5
  cmd: "watch" | "build";
@@ -1,4 +1,4 @@
1
- import { TNormPath } from "@simplysm/sd-core-node";
1
+ import { type TNormPath } from "@simplysm/sd-core-node";
2
2
 
3
3
  export interface ISdBuildRunnerResult {
4
4
  affectedFilePathSet: Set<TNormPath>;
@@ -1,7 +1,7 @@
1
- import { CompilerOptions } from "typescript";
1
+ import { type CompilerOptions } from "typescript";
2
2
  import esbuild from "esbuild";
3
- import { ISdBuildMessage } from "./build.type";
4
- import { TNormPath } from "@simplysm/sd-core-node";
3
+ import { type ISdBuildMessage } from "./build.type";
4
+ import { type TNormPath } from "@simplysm/sd-core-node";
5
5
 
6
6
  export interface SdTsCompilerOptions {
7
7
  pkgPath: TNormPath;
@@ -1,5 +1,5 @@
1
- import { ISdBuildRunnerWorkerRequest } from "./build-runner.type";
2
- import { ISdBuildMessage, ISdBuildRunnerResult } from "./build.type";
1
+ import { type ISdBuildRunnerWorkerRequest } from "./build-runner.type";
2
+ import { type ISdBuildMessage, type ISdBuildRunnerResult } from "./build.type";
3
3
 
4
4
  export interface TServerWorkerType {
5
5
  methods: {
@@ -1,9 +1,9 @@
1
1
  import ts from "typescript";
2
2
  import os from "os";
3
3
  import path from "path";
4
- import { PartialMessage } from "esbuild";
4
+ import { type PartialMessage } from "esbuild";
5
5
  import { ESLint } from "eslint";
6
- import { ISdBuildMessage } from "../types/build.type";
6
+ import { type ISdBuildMessage } from "../types/build.type";
7
7
  import { PathUtil } from "@simplysm/sd-core-node";
8
8
 
9
9
  export class SdCliConvertMessageUtil {
@@ -1,12 +1,12 @@
1
1
  import { createSdWorker, FsUtil, Logger, LoggerSeverity } from "@simplysm/sd-core-node";
2
- import { ISdBuildMessage } from "../types/build.type";
2
+ import { type ISdBuildMessage } from "../types/build.type";
3
3
  import path from "path";
4
4
  import { SdServerBuildRunner } from "../pkg-builders/server/SdServerBuildRunner";
5
5
  import { SdClientBuildRunner } from "../pkg-builders/client/SdClientBuildRunner";
6
6
  import { SdTsLibBuildRunner } from "../pkg-builders/lib/SdTsLibBuildRunner";
7
7
  import { SdJsLibBuildRunner } from "../pkg-builders/lib/SdJsLibBuildRunner";
8
- import { TSdBuildRunnerWorkerType } from "../types/workers.type";
9
- import { ISdBuildRunnerWorkerRequest } from "../types/build-runner.type";
8
+ import { type TSdBuildRunnerWorkerType } from "../types/workers.type";
9
+ import { type ISdBuildRunnerWorkerRequest } from "../types/build-runner.type";
10
10
  import { EventEmitter } from "events";
11
11
 
12
12
  Error.stackTraceLimit = Infinity;
@@ -3,7 +3,7 @@ import { pathToFileURL } from "url";
3
3
  import { SdServiceServer } from "@simplysm/sd-service-server";
4
4
  import { createSdWorker, Logger, LoggerSeverity } from "@simplysm/sd-core-node";
5
5
  import { EventEmitter } from "events";
6
- import { TServerWorkerType } from "../types/workers.type";
6
+ import { type TServerWorkerType } from "../types/workers.type";
7
7
 
8
8
  Error.stackTraceLimit = Infinity;
9
9
  EventEmitter.defaultMaxListeners = 0;
package/tsconfig.json CHANGED
@@ -3,5 +3,6 @@
3
3
  "compilerOptions": {
4
4
  "lib": ["ES2021"],
5
5
  "outDir": "./dist"
6
- }
6
+ },
7
+ "exclude": ["dist", "node_modules"]
7
8
  }