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