@simplysm/sd-cli 10.0.66 → 11.0.4

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 (89) hide show
  1. package/dist/build-cluster.js +16 -15
  2. package/dist/build-cluster.js.map +1 -1
  3. package/dist/build-tools/SdNgBundler.d.ts +20 -0
  4. package/dist/build-tools/SdNgBundler.js +312 -0
  5. package/dist/build-tools/SdNgBundler.js.map +1 -0
  6. package/dist/build-tools/SdTsBundler.d.ts +15 -0
  7. package/dist/build-tools/SdTsBundler.js +96 -0
  8. package/dist/build-tools/SdTsBundler.js.map +1 -0
  9. package/dist/build-tools/SdTsCompiler.d.ts +28 -0
  10. package/dist/build-tools/SdTsCompiler.js +212 -0
  11. package/dist/build-tools/SdTsCompiler.js.map +1 -0
  12. package/dist/builders/SdCliClientBuilder.d.ts +5 -7
  13. package/dist/builders/SdCliClientBuilder.js +75 -267
  14. package/dist/builders/SdCliClientBuilder.js.map +1 -1
  15. package/dist/builders/SdCliServerBuilder.d.ts +4 -3
  16. package/dist/builders/SdCliServerBuilder.js +82 -218
  17. package/dist/builders/SdCliServerBuilder.js.map +1 -1
  18. package/dist/builders/SdCliTsLibBuilder.d.ts +3 -4
  19. package/dist/builders/SdCliTsLibBuilder.js +37 -87
  20. package/dist/builders/SdCliTsLibBuilder.js.map +1 -1
  21. package/dist/commons.d.ts +11 -5
  22. package/dist/entry/SdCliProject.js +22 -18
  23. package/dist/entry/SdCliProject.js.map +1 -1
  24. package/dist/index.d.ts +3 -11
  25. package/dist/index.js +3 -11
  26. package/dist/index.js.map +1 -1
  27. package/dist/sd-cli.js +0 -19
  28. package/dist/sd-cli.js.map +1 -1
  29. package/dist/server-worker.js +3 -0
  30. package/dist/server-worker.js.map +1 -1
  31. package/package.json +17 -19
  32. package/src/build-cluster.ts +16 -15
  33. package/src/build-tools/SdNgBundler.ts +381 -0
  34. package/src/build-tools/SdTsBundler.ts +106 -0
  35. package/src/build-tools/SdTsCompiler.ts +304 -0
  36. package/src/builders/SdCliClientBuilder.ts +93 -312
  37. package/src/builders/SdCliServerBuilder.ts +99 -242
  38. package/src/builders/SdCliTsLibBuilder.ts +41 -111
  39. package/src/commons.ts +11 -5
  40. package/src/entry/SdCliElectron.ts +3 -3
  41. package/src/entry/SdCliLocalUpdate.ts +3 -3
  42. package/src/entry/SdCliProject.ts +33 -26
  43. package/src/index.ts +3 -11
  44. package/src/sd-cli.ts +0 -23
  45. package/src/server-worker.ts +3 -0
  46. package/dist/build-tools/SdTsIncrementalBuilder.d.ts +0 -29
  47. package/dist/build-tools/SdTsIncrementalBuilder.js +0 -75
  48. package/dist/build-tools/SdTsIncrementalBuilder.js.map +0 -1
  49. package/dist/entry/SdCliPwaAssets.d.ts +0 -6
  50. package/dist/entry/SdCliPwaAssets.js +0 -39
  51. package/dist/entry/SdCliPwaAssets.js.map +0 -1
  52. package/dist/utils/SdCliViteElectronMainPlugin.d.ts +0 -6
  53. package/dist/utils/SdCliViteElectronMainPlugin.js +0 -96
  54. package/dist/utils/SdCliViteElectronMainPlugin.js.map +0 -1
  55. package/dist/utils/SdCliViteExternalPlugin.d.ts +0 -6
  56. package/dist/utils/SdCliViteExternalPlugin.js +0 -85
  57. package/dist/utils/SdCliViteExternalPlugin.js.map +0 -1
  58. package/dist/utils/SdCliViteLazyImportPlugin.d.ts +0 -2
  59. package/dist/utils/SdCliViteLazyImportPlugin.js +0 -23
  60. package/dist/utils/SdCliViteLazyImportPlugin.js.map +0 -1
  61. package/dist/utils/SdCliViteLoggerPlugin.d.ts +0 -6
  62. package/dist/utils/SdCliViteLoggerPlugin.js +0 -24
  63. package/dist/utils/SdCliViteLoggerPlugin.js.map +0 -1
  64. package/dist/utils/SdCliViteNodeGlobalPlugin.d.ts +0 -2
  65. package/dist/utils/SdCliViteNodeGlobalPlugin.js +0 -29
  66. package/dist/utils/SdCliViteNodeGlobalPlugin.js.map +0 -1
  67. package/dist/utils/SdCliViteReactSwcPlugin.d.ts +0 -2
  68. package/dist/utils/SdCliViteReactSwcPlugin.js +0 -139
  69. package/dist/utils/SdCliViteReactSwcPlugin.js.map +0 -1
  70. package/dist/utils/SdCliViteServeOptimizeExcludePlugin.d.ts +0 -2
  71. package/dist/utils/SdCliViteServeOptimizeExcludePlugin.js +0 -36
  72. package/dist/utils/SdCliViteServeOptimizeExcludePlugin.js.map +0 -1
  73. package/dist/utils/getElectronReactExternals.d.ts +0 -1
  74. package/dist/utils/getElectronReactExternals.js +0 -17
  75. package/dist/utils/getElectronReactExternals.js.map +0 -1
  76. package/dist/utils/sdCliTsDefineTransformer.d.ts +0 -4
  77. package/dist/utils/sdCliTsDefineTransformer.js +0 -26
  78. package/dist/utils/sdCliTsDefineTransformer.js.map +0 -1
  79. package/src/build-tools/SdTsIncrementalBuilder.ts +0 -125
  80. package/src/entry/SdCliPwaAssets.ts +0 -50
  81. package/src/utils/SdCliViteElectronMainPlugin.ts +0 -102
  82. package/src/utils/SdCliViteExternalPlugin.ts +0 -98
  83. package/src/utils/SdCliViteLazyImportPlugin.ts +0 -26
  84. package/src/utils/SdCliViteLoggerPlugin.ts +0 -29
  85. package/src/utils/SdCliViteNodeGlobalPlugin.ts +0 -31
  86. package/src/utils/SdCliViteReactSwcPlugin.ts +0 -153
  87. package/src/utils/SdCliViteServeOptimizeExcludePlugin.ts +0 -42
  88. package/src/utils/getElectronReactExternals.ts +0 -19
  89. package/src/utils/sdCliTsDefineTransformer.ts +0 -33
@@ -1,31 +1,20 @@
1
1
  import {EventEmitter} from "events";
2
- import {FsUtil, Logger, SdFsWatcher, SdProcess} from "@simplysm/sd-core-node";
3
- import {INpmConfig, ISdCliBuilderResult, ISdCliClientPackageConfig, ISdCliPackageBuildResult} from "../commons";
4
- import {FunctionQueue, MathUtil} from "@simplysm/sd-core-common";
5
- import * as vite from "vite";
6
- import {defineConfig, InlineConfig} from "vite";
7
- import vitePluginPaths from "vite-tsconfig-paths";
2
+ import {FsUtil, Logger, SdFsWatcher} from "@simplysm/sd-core-node";
3
+ import {ISdCliBuilderResult, ISdCliClientPackageConfig, ISdCliConfig} from "../commons";
4
+ import {FunctionQueue} from "@simplysm/sd-core-common";
8
5
  import path from "path";
9
- import {SdTsIncrementalBuilder} from "../build-tools/SdTsIncrementalBuilder";
6
+ import {SdTsCompiler} from "../build-tools/SdTsCompiler";
7
+ import {SdNgBundler} from "../build-tools/SdNgBundler";
10
8
  import {SdLinter} from "../build-tools/SdLinter";
11
- import {VitePWA} from 'vite-plugin-pwa';
12
- import {SdCliViteNodeGlobalPlugin} from "../utils/SdCliViteNodeGlobalPlugin";
13
- import {SdCliViteLoggerPlugin} from "../utils/SdCliViteLoggerPlugin";
14
- import {SdCliViteReactSwcPlugin} from "../utils/SdCliViteReactSwcPlugin";
15
- import {SdCliViteExternalPlugin} from "../utils/SdCliViteExternalPlugin";
16
- import {SdCliViteElectronMainPlugin} from "../utils/SdCliViteElectronMainPlugin";
17
- import electronBuilder from "electron-builder";
18
- import {SdCliViteServeOptimizeExcludePlugin} from "../utils/SdCliViteServeOptimizeExcludePlugin";
19
- import {SdCliViteLazyImportPlugin} from "../utils/SdCliViteLazyImportPlugin";
20
9
 
21
10
  export class SdCliClientBuilder extends EventEmitter {
22
11
  private readonly _logger = Logger.get(["simplysm", "sd-cli", "SdCliClientBuilder"]);
12
+ private readonly _pkgConf: ISdCliClientPackageConfig;
23
13
 
24
- public constructor(private readonly _pkgPath: string,
25
- private readonly _pkgConf: ISdCliClientPackageConfig,
26
- private readonly _builderKey: "web" | "electron",
27
- private readonly _withLint: boolean) {
14
+ public constructor(private readonly _projConf: ISdCliConfig,
15
+ private readonly _pkgPath: string) {
28
16
  super();
17
+ this._pkgConf = this._projConf.packages[path.basename(_pkgPath)] as ISdCliClientPackageConfig;
29
18
  }
30
19
 
31
20
  public override on(event: "change", listener: () => void): this;
@@ -35,320 +24,112 @@ export class SdCliClientBuilder extends EventEmitter {
35
24
  return this;
36
25
  }
37
26
 
38
- public async watchAsync(): Promise<number> {
39
- const cachePath = path.resolve(this._pkgPath, ".cache", "dev", ...this._builderKey !== "web" ? [this._builderKey] : []);
40
-
41
- this.emit("change");
42
-
43
- this._debug("BUILD...");
44
- const viteServerPort = this._pkgConf.builder?.[this._builderKey]?.["devServerPort"] ?? MathUtil.getRandomInt(60000, 65535);
45
- const viteServer = await vite.createServer(this._getViteConfig({
46
- dev: true,
47
- pkgConf: this._pkgConf,
48
- cachePath: cachePath,
49
- port: viteServerPort,
27
+ public async buildAsync(): Promise<ISdCliBuilderResult> {
28
+ this._debug("dist 초기화...");
29
+ await FsUtil.removeAsync(path.resolve(this._pkgPath, "dist"));
30
+
31
+ this._debug("GEN .config...");
32
+ const confDistPath = this._pkgConf.server !== undefined
33
+ ? path.resolve(this._pkgPath, "../../packages", this._pkgConf.server, "dist/www", path.basename(this._pkgPath), ".config.json")
34
+ : path.resolve(this._pkgPath, "dist");
35
+ await FsUtil.writeFileAsync(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
36
+
37
+ this._debug(`BUILD 준비...`);
38
+ const builderTypes = (Object.keys(this._pkgConf.builder ?? {web: {}}) as ("web")[]);
39
+ const builders = builderTypes.map((builderType) => new SdNgBundler({
40
+ dev: false,
41
+ builderType: builderType,
42
+ pkgPath: this._pkgPath
50
43
  }));
51
- await viteServer.listen(viteServerPort);
52
-
53
- this._debug("CHECK...");
54
- const sdTsProgram = await SdTsIncrementalBuilder.createAsync(this._pkgPath, () => ({emitJs: false}));
55
- const checkResult = await sdTsProgram.buildAsync();
56
-
57
- this._debug("LINT...");
58
- const lintResults = !this._withLint ? [] : await SdLinter.lintAsync(checkResult.affectedFilePaths, sdTsProgram.builderProgram!.getProgram());
59
-
60
- this._debug("WATCH...");
61
- const fnQ = new FunctionQueue();
62
- SdFsWatcher
63
- .watch([
64
- ...sdTsProgram.builderProgram!.getSourceFiles().map((item) => item.fileName),
65
- path.resolve(this._pkgPath, "src/**/*.{ts,tsx}")
66
- ])
67
- .onChange({
68
- delay: 100
69
- }, () => {
70
- fnQ.runLast(async () => {
71
- this.emit("change");
72
44
 
73
- this._debug(`CHECK...`);
74
- const watchCheckResult = await sdTsProgram.buildAsync();
45
+ const checker = new SdTsCompiler({
46
+ pkgPath: this._pkgPath,
47
+ emit: false,
48
+ emitDts: false,
49
+ globalStyle: false
50
+ });
75
51
 
76
- this._debug(`LINT...`);
77
- const watchLintResults = !this._withLint ? [] : await SdLinter.lintAsync(watchCheckResult.affectedFilePaths, sdTsProgram.builderProgram!.getProgram());
52
+ this._debug(`BUILD...`);
53
+ const buildResults = (
54
+ await Promise.all(builders.map((builder) => builder.bundleAsync()))
55
+ ).mapMany();
78
56
 
79
- this._debug(`빌드 완료`);
80
- this.emit("complete", {
81
- port: viteServerPort,
82
- affectedFilePaths: watchCheckResult.affectedFilePaths,
83
- buildResults: [...watchCheckResult.results, ...watchLintResults]
84
- });
85
- });
86
- });
57
+ this._debug("CHECK...");
58
+ const checkResult = await checker.buildAsync();
87
59
 
88
- if (this._pkgConf.server !== undefined) {
89
- this._debug("GEN .config...");
90
- const confDistPath = path.resolve(this._pkgPath, "../../packages", this._pkgConf.server, "dist/www", path.basename(this._pkgPath), ".config.json");
91
- await FsUtil.writeFileAsync(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
92
- }
60
+ this._debug(`LINT...`);
61
+ const lintResults = await SdLinter.lintAsync(checkResult.affectedFilePaths, checker.program);
93
62
 
94
63
  this._debug(`빌드 완료`);
95
- this.emit("complete", {
96
- port: viteServerPort,
64
+ return {
97
65
  affectedFilePaths: checkResult.affectedFilePaths,
98
- buildResults: [...checkResult.results, ...lintResults]
99
- });
100
-
101
- return viteServerPort;
66
+ buildResults: [...buildResults, ...checkResult.results, ...lintResults]
67
+ };
102
68
  }
103
69
 
104
- public async buildAsync(): Promise<ISdCliBuilderResult> {
70
+ public async watchAsync(): Promise<void> {
105
71
  this._debug("dist 초기화...");
106
- const cachePath = path.resolve(this._pkgPath, ".cache", "prod", ...this._builderKey !== "web" ? [this._builderKey] : []);
107
- const distPath = path.resolve(this._pkgPath, "dist", ...this._builderKey !== "web" ? [this._builderKey] : []);
108
- await FsUtil.removeAsync(cachePath);
109
- await FsUtil.removeAsync(distPath);
110
-
111
- this._debug("BUILD...");
112
- const buildResults: ISdCliPackageBuildResult[] = [];
113
- try {
114
- await vite.build(this._getViteConfig({
115
- dev: false,
116
- pkgConf: this._pkgConf,
117
- cachePath: cachePath,
118
- distPath: distPath,
119
- }));
120
- }
121
- catch (err) {
122
- if ("errors" in err && err.errors instanceof Array) {
123
- buildResults.push(...err.errors.map((item: any) => ({
124
- filePath: item.location.file,
125
- line: item.location.line,
126
- char: item.location.column,
127
- code: undefined,
128
- severity: "error" as const,
129
- message: item.text
130
- })));
131
- }
132
- if ("warnings" in err && err.warnings instanceof Array) {
133
- buildResults.push(...err.warnings.map((item: any) => ({
134
- filePath: item.location.file,
135
- line: item.location.line,
136
- char: item.location.column,
137
- code: undefined,
138
- severity: "warning" as const,
139
- message: item.text
140
- })));
141
- }
142
- }
143
-
144
- this._debug("CHECK...");
145
- const sdTsProgram = await SdTsIncrementalBuilder.createAsync(this._pkgPath, () => ({emitJs: false}));
146
- const checkResult = await sdTsProgram.buildAsync();
147
-
148
- this._debug("LINT...");
149
- const lintResults = !this._withLint ? [] : await SdLinter.lintAsync(checkResult.affectedFilePaths, sdTsProgram.builderProgram!.getProgram());
150
-
151
- if (this._pkgConf.server !== undefined) {
152
- const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
153
- this._debug("GEN .config...");
154
- await FsUtil.writeFileAsync(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
155
- }
72
+ await FsUtil.removeAsync(path.resolve(this._pkgPath, "dist"));
156
73
 
157
- if (this._builderKey === "electron") {
158
- const electronSrcPath = path.resolve(this._pkgPath, ".cache/prod/electron/src");
159
- const electronDistPath = path.resolve(this._pkgPath, ".cache/prod/electron/dist");
160
- const pkgNpmConfig = (await FsUtil.readJsonAsync(path.resolve(this._pkgPath, `package.json`))) as INpmConfig;
74
+ this._debug("GEN .config...");
75
+ const confDistPath = this._pkgConf.server !== undefined
76
+ ? path.resolve(this._pkgPath, "../../packages", this._pkgConf.server, "dist/www", path.basename(this._pkgPath), ".config.json")
77
+ : path.resolve(this._pkgPath, "dist");
78
+ await FsUtil.writeFileAsync(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
161
79
 
162
- this._debug("package.json 파일 쓰기...");
163
- const externalPkgNames = this._pkgConf.builder!.electron!.reinstallDependencies ?? [];
164
-
165
- await FsUtil.writeJsonAsync(path.resolve(electronSrcPath, `package.json`), {
166
- name: pkgNpmConfig.name,
167
- version: pkgNpmConfig.version,
168
- description: pkgNpmConfig.description,
169
- main: "electron-main.js",
170
- ...this._pkgConf.builder!.electron!.postInstallScript !== undefined ? {
171
- scripts: {
172
- "postinstall": this._pkgConf.builder!.electron!.postInstallScript
173
- },
174
- } : {},
175
- dependencies: externalPkgNames.toObject((item) => item, (item) => pkgNpmConfig.dependencies![item] ?? "*")
176
- });
177
-
178
- this._debug("npm install...");
179
- await SdProcess.spawnAsync(`npm install`, {cwd: electronSrcPath}, true);
80
+ this._debug(`BUILD 준비...`);
81
+ const builderTypes = (Object.keys(this._pkgConf.builder ?? {web: {}}) as ("web")[]);
82
+ const builders = builderTypes.map((builderType) => new SdNgBundler({
83
+ dev: true,
84
+ builderType: builderType,
85
+ pkgPath: this._pkgPath
86
+ }));
180
87
 
181
- for (const externalPkgName of externalPkgNames) {
182
- if (FsUtil.exists(path.resolve(electronSrcPath, "node_modules", externalPkgName, "binding.gyp"))) {
183
- this._debug(`electron rebuild (${externalPkgName})...`);
184
- await SdProcess.spawnAsync(`electron-rebuild -m ./node_modules/${externalPkgName}`, {cwd: electronSrcPath}, true);
185
- }
186
- }
88
+ const checker = new SdTsCompiler({
89
+ pkgPath: this._pkgPath,
90
+ emit: false,
91
+ emitDts: false,
92
+ globalStyle: false
93
+ });
187
94
 
188
- await electronBuilder.build({
189
- targets: electronBuilder.Platform.WINDOWS.createTarget(),
190
- config: {
191
- appId: this._pkgConf.builder!.electron!.appId,
192
- productName: pkgNpmConfig.description,
193
- // asar: false,
194
- win: {
195
- target: "nsis"
196
- },
197
- nsis: {},
198
- directories: {
199
- app: electronSrcPath,
200
- output: electronDistPath
201
- },
202
- ...this._pkgConf.builder!.electron!.installerIcon !== undefined ? {
203
- icon: path.resolve(this._pkgPath, "src", this._pkgConf.builder!.electron!.installerIcon)
204
- } : {},
205
- removePackageScripts: false
95
+ this._debug("WATCH...");
96
+ const fnQ = new FunctionQueue();
97
+ const watcher = SdFsWatcher
98
+ .watch([
99
+ path.resolve(this._pkgPath, "src/**/*.*")
100
+ ], {
101
+ ignoreInitial: false
102
+ })
103
+ .onChange({
104
+ delay: 100
105
+ }, (changeInfos) => {
106
+ for (const builder of builders) {
107
+ builder.removeCache(changeInfos.map((item) => item.path));
206
108
  }
207
- });
208
-
209
- await FsUtil.copyAsync(
210
- path.resolve(electronDistPath, `${pkgNpmConfig.description} Setup ${pkgNpmConfig.version}.exe`),
211
- path.resolve(distPath, `electron/${pkgNpmConfig.description}-latest.exe`)
212
- );
213
-
214
- await FsUtil.copyAsync(
215
- path.resolve(electronDistPath, `${pkgNpmConfig.description} Setup ${pkgNpmConfig.version}.exe`),
216
- path.resolve(distPath, `electron/updates/${pkgNpmConfig.version}.exe`)
217
- );
218
- }
219
-
220
-
221
- this._debug(`빌드 완료`);
222
- return {
223
- affectedFilePaths: checkResult.affectedFilePaths,
224
- buildResults: [...buildResults, ...checkResult.results, ...lintResults]
225
- };
226
- }
227
109
 
228
- private _getViteConfig(opt: {
229
- dev: boolean,
230
- cachePath: string,
231
- distPath?: string,
232
- port?: number,
233
- pkgConf: ISdCliClientPackageConfig
234
- }): InlineConfig {
235
- const pkgNpmConf: INpmConfig = FsUtil.readJson(path.resolve(this._pkgPath, "package.json"));
110
+ fnQ.runLast(async () => {
111
+ this.emit("change");
236
112
 
237
- const basePath = this._builderKey === "electron" ? "" : (!opt.dev || this._pkgConf.server !== undefined) ? ("/" + path.basename(this._pkgPath) + "/") : "/";
113
+ this._debug(`BUILD...`);
114
+ const buildResults = (
115
+ await Promise.all(builders.map((builder) => builder.bundleAsync()))
116
+ ).mapMany();
238
117
 
239
- const serverHost = this._pkgConf.builder?.[this._builderKey]?.devServerHost ?? "localhost";
118
+ this._debug("CHECK...");
119
+ const checkResult = await checker.buildAsync();
240
120
 
241
- const define = {
242
- ...opt.dev ? {
243
- "import.meta.env.SD_SERVER_URL": JSON.stringify(`http://${serverHost}:${opt.port}` + basePath)
244
- } : {},
245
- "import.meta.env.SD_VERSION": JSON.stringify(pkgNpmConf.version),
246
- ...this._pkgConf.env
247
- ? Object.keys(this._pkgConf.env)
248
- .toObject(
249
- (key) => "import.meta.env." + key,
250
- (key) => JSON.stringify(this._pkgConf.env![key])
251
- )
252
- : {},
253
- ...this._pkgConf.builder?.[this._builderKey]?.env
254
- ? Object.keys(this._pkgConf.builder[this._builderKey]!.env!)
255
- .toObject(
256
- (key) => "import.meta.env." + key,
257
- (key) => JSON.stringify(this._pkgConf.builder![this._builderKey]!.env![key])
258
- )
259
- : {}
260
- };
121
+ this._debug(`LINT...`);
122
+ const lintResults = await SdLinter.lintAsync(checkResult.affectedFilePaths, checker.program);
261
123
 
262
- return defineConfig({
263
- mode: opt.dev ? "development" : "production",
264
- root: path.resolve(this._pkgPath, "src"),
265
- cacheDir: path.resolve(opt.cachePath, "vite"),
266
- base: basePath,
267
- assetsInclude: [
268
- "**/*.xlsx",
269
- "**/*.xls",
270
- "**/*.docx",
271
- "**/*.doc",
272
- "**/*.pptx",
273
- "**/*.ppt",
274
- "**/*.woff",
275
- "**/*.woff2",
276
- "**/*.ttf",
277
- "**/*.eot",
278
- "**/*.otf",
279
- "**/*.csv",
280
- "**/*.zip",
281
- "**/*.pfx",
282
- "**/*.pkl"
283
- ],
284
- define: define,
285
- ...opt.dev ? {
286
- server: {
287
- host: serverHost,
288
- port: opt.port,
289
- hmr: {
290
- host: serverHost,
291
- port: opt.port
292
- }
293
- },
294
- } : {},
295
- optimizeDeps: {
296
- force: true
297
- },
298
- ...!opt.dev ? {
299
- build: {
300
- outDir: this._builderKey === "electron" ? path.resolve(opt.cachePath, "src") : opt.distPath,
301
- rollupOptions: {
302
- output: {
303
- entryFileNames: `assets/[name].js`,
304
- chunkFileNames: `assets/[name].js`,
305
- assetFileNames: `assets/[name].[ext]`
306
- }
307
- }
308
- }
309
- } : {},
310
- plugins: [
311
- SdCliViteReactSwcPlugin(),
312
- SdCliViteLoggerPlugin({
313
- logger: this._logger,
314
- name: path.basename(this._pkgPath)
315
- }),
316
- vitePluginPaths(),
317
- ...opt.dev ? [
318
- SdCliViteLazyImportPlugin()
319
- ] : [],
320
- ...opt.dev ? [
321
- SdCliViteServeOptimizeExcludePlugin([
322
- "@simplysm/*"
323
- ])
324
- ] : [],
325
- ...!opt.dev && this._builderKey === "web" ? [
326
- VitePWA({
327
- mode: "production",
328
- base: `/${path.basename(this._pkgPath)}/`,
329
- includeAssets: ["favicon.ico", "assets/icons/apple-touch-icon-180x180.png", "assets/icons/maskable-icon-512x512.png"],
124
+ this._debug(`빌드 완료`);
125
+ this.emit("complete", {
126
+ affectedFilePaths: checkResult.affectedFilePaths,
127
+ buildResults: [...buildResults, ...checkResult.results, ...lintResults]
128
+ });
330
129
 
331
- registerType: 'autoUpdate',
332
- manifest: FsUtil.readJson(path.resolve(this._pkgPath, "src/manifest.json"))
333
- }),
334
- ] : [],
335
- ...this._builderKey === "web" ? [
336
- SdCliViteNodeGlobalPlugin()
337
- ] : [],
338
- ...this._builderKey === "electron" ? [
339
- SdCliViteElectronMainPlugin({
340
- entry: path.resolve(this._pkgPath, "src/electron-main.ts"),
341
- distPath: path.resolve(opt.cachePath, "src"),
342
- cachePath: path.resolve(opt.cachePath, "electron-main")
343
- }),
344
- SdCliViteExternalPlugin({
345
- target: "browser",
346
- cachePath: path.resolve(opt.cachePath, "external"),
347
- includes: opt.pkgConf.builder?.electron?.reinstallDependencies
348
- })
349
- ] : [],
350
- ],
351
- });
130
+ watcher.add(checker.program.getSourceFiles().map((item) => item.fileName));
131
+ });
132
+ });
352
133
  }
353
134
 
354
135
  private _debug(msg: string): void {