@simplysm/sd-cli 12.13.21 → 12.13.23
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/package.json +12 -12
- package/src/entry/{sd-cli-cordova.ts → SdCliCordova.ts} +2 -2
- package/src/entry/{sd-cli-electron.ts → SdCliElectron.ts} +3 -3
- package/src/entry/{sd-cli-local-update.ts → SdCliLocalUpdate.ts} +6 -4
- package/src/entry/{sd-cli-project.ts → SdCliProject.ts} +55 -71
- package/src/pkg-builders/SdProjectBuildRunner.ts +347 -0
- package/src/pkg-builders/client/{sd-client.build-runner.ts → SdClientBuildRunner.ts} +31 -38
- package/src/pkg-builders/client/{sd-ng.bundler.ts → SdNgBundler.ts} +22 -31
- package/src/pkg-builders/client/{sd-ng.bundler-context.ts → SdNgBundlerContext.ts} +7 -9
- package/src/pkg-builders/client/{sd-ng.plugin-creator.ts → createSdNgPlugin.ts} +11 -94
- package/src/pkg-builders/commons/{scope-path.ts → ScopePathSet.ts} +3 -3
- package/src/pkg-builders/commons/SdBuildRunnerBase.ts +47 -0
- package/src/pkg-builders/lib/{sd-cli-db-context.file-generator.ts → SdCliDbContextFileGenerator.ts} +1 -1
- package/src/pkg-builders/lib/{sd-js-lib.build-runner.ts → SdJsLibBuildRunner.ts} +13 -32
- package/src/pkg-builders/lib/SdTsLibBuildRunner.ts +47 -0
- package/src/pkg-builders/lib/{sd-ts-lib.builder.ts → SdTsLibBuilder.ts} +12 -14
- package/src/pkg-builders/server/{sd-server.build-runner.ts → SdServerBuildRunner.ts} +25 -48
- package/src/pkg-builders/server/{sd-server.bundler.ts → SdServerBundler.ts} +26 -23
- package/src/pkg-builders/server/{sd-server.plugin-creator.ts → createSdServerPlugin.ts} +9 -7
- package/src/sd-cli-entry.ts +6 -12
- package/src/sd-cli.ts +1 -15
- package/src/ts-compiler/{sd-dependency-analyzer.ts → SdDepAnalyzer.ts} +5 -9
- package/src/ts-compiler/{sd-dependency-cache.ts → SdDepCache.ts} +1 -137
- package/src/ts-compiler/{sd-style-bundler.ts → SdStyleBundler.ts} +5 -5
- package/src/ts-compiler/{sd-ts-compiler.ts → SdTsCompiler.ts} +17 -144
- package/src/types/{build.types.ts → build/ISdBuildMessage.ts} +0 -6
- package/src/types/build/ISdBuildResult.ts +9 -0
- package/src/types/build/ISdTsCompilerOptions.ts +15 -0
- package/src/types/build/ISdTsCompilerResult.ts +12 -0
- package/src/types/build/TStylesheetBundlingResult.ts +15 -0
- package/src/types/{common-configs.types.ts → common-config/INpmConfig.ts} +0 -6
- package/src/types/common-config/ITsConfig.ts +5 -0
- package/src/types/{config.types.ts → config/ISdProjectConfig.ts} +0 -1
- package/src/types/plugin/ISdCliNgPluginResultCache.ts +9 -0
- package/src/types/{build-plugin.types.ts → plugin/ISdCliServerPluginResultCache.ts} +0 -7
- package/src/types/worker/ISdBuildRunnerWorkerType.ts +24 -0
- package/src/types/worker/IServerWorkerType.ts +8 -0
- package/src/utils/{sd-cli-convert-message.utils.ts → SdCliConvertMessageUtils.ts} +6 -3
- package/src/{entry/utils → utils}/loadProjConfAsync.ts +10 -6
- package/src/workers/build-runner.worker.ts +30 -29
- package/src/workers/server.worker.ts +7 -7
- package/tests/deps/sd-dependency-analyzer.spec.ts +38 -69
- package/tests/deps/sd-dependency-cache.spec.ts +3 -6
- package/dist/entry/sd-cli-ai-command.d.ts +0 -3
- package/dist/entry/sd-cli-ai-command.js +0 -65
- package/dist/entry/sd-cli-ai-command.js.map +0 -1
- package/dist/entry/sd-cli-cordova.d.ts +0 -16
- package/dist/entry/sd-cli-cordova.js +0 -398
- package/dist/entry/sd-cli-cordova.js.map +0 -1
- package/dist/entry/sd-cli-electron.d.ts +0 -18
- package/dist/entry/sd-cli-electron.js +0 -129
- package/dist/entry/sd-cli-electron.js.map +0 -1
- package/dist/entry/sd-cli-local-update.d.ts +0 -11
- package/dist/entry/sd-cli-local-update.js +0 -84
- package/dist/entry/sd-cli-local-update.js.map +0 -1
- package/dist/entry/sd-cli-postinstall.d.ts +0 -3
- package/dist/entry/sd-cli-postinstall.js +0 -39
- package/dist/entry/sd-cli-postinstall.js.map +0 -1
- package/dist/entry/sd-cli-project.d.ts +0 -22
- package/dist/entry/sd-cli-project.js +0 -325
- package/dist/entry/sd-cli-project.js.map +0 -1
- package/dist/entry/utils/loadProjConfAsync.d.ts +0 -5
- package/dist/entry/utils/loadProjConfAsync.js +0 -8
- package/dist/entry/utils/loadProjConfAsync.js.map +0 -1
- package/dist/fix/convert-extends-sd-modal-base-to-interface.d.ts +0 -1
- package/dist/fix/convert-extends-sd-modal-base-to-interface.js +0 -289
- package/dist/fix/convert-extends-sd-modal-base-to-interface.js.map +0 -1
- package/dist/fix/convert-extends-sd-print-template-base-to-interface.d.ts +0 -1
- package/dist/fix/convert-extends-sd-print-template-base-to-interface.js +0 -179
- package/dist/fix/convert-extends-sd-print-template-base-to-interface.js.map +0 -1
- package/dist/fix/convert-flat-pages-to-flat-menus.d.ts +0 -1
- package/dist/fix/convert-flat-pages-to-flat-menus.js +0 -68
- package/dist/fix/convert-flat-pages-to-flat-menus.js.map +0 -1
- package/dist/fix/convert-get-menus-to-usable-menus.d.ts +0 -1
- package/dist/fix/convert-get-menus-to-usable-menus.js +0 -48
- package/dist/fix/convert-get-menus-to-usable-menus.js.map +0 -1
- package/dist/fix/convert-modal-show-params.d.ts +0 -1
- package/dist/fix/convert-modal-show-params.js +0 -29
- package/dist/fix/convert-modal-show-params.js.map +0 -1
- package/dist/fix/convert-print-params.d.ts +0 -1
- package/dist/fix/convert-print-params.js +0 -37
- package/dist/fix/convert-print-params.js.map +0 -1
- package/dist/fix/convert-private-to-hash.d.ts +0 -1
- package/dist/fix/convert-private-to-hash.js +0 -59
- package/dist/fix/convert-private-to-hash.js.map +0 -1
- package/dist/fix/convert-sd-angular-symbol-names.d.ts +0 -1
- package/dist/fix/convert-sd-angular-symbol-names.js +0 -23
- package/dist/fix/convert-sd-angular-symbol-names.js.map +0 -1
- package/dist/fix/convert-sd-icon-to-fa-icon.d.ts +0 -1
- package/dist/fix/convert-sd-icon-to-fa-icon.js +0 -80
- package/dist/fix/convert-sd-icon-to-fa-icon.js.map +0 -1
- package/dist/fix/convert-sd-sheet-bindings-safety.d.ts +0 -1
- package/dist/fix/convert-sd-sheet-bindings-safety.js +0 -57
- package/dist/fix/convert-sd-sheet-bindings-safety.js.map +0 -1
- package/dist/fix/convert-select-modal-button-to-select-button.d.ts +0 -1
- package/dist/fix/convert-select-modal-button-to-select-button.js +0 -64
- package/dist/fix/convert-select-modal-button-to-select-button.js.map +0 -1
- package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.d.ts +0 -1
- package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.js +0 -38
- package/dist/fix/convert-setup-cumulate-selected-keys-to-object-param.js.map +0 -1
- package/dist/fix/convert-to-use-perms-signal.d.ts +0 -1
- package/dist/fix/convert-to-use-perms-signal.js +0 -99
- package/dist/fix/convert-to-use-perms-signal.js.map +0 -1
- package/dist/fix/core/convert-symbol.d.ts +0 -1
- package/dist/fix/core/convert-symbol.js +0 -93
- package/dist/fix/core/convert-symbol.js.map +0 -1
- package/dist/fix/core/get-ts-morph-source-files.d.ts +0 -1
- package/dist/fix/core/get-ts-morph-source-files.js +0 -8
- package/dist/fix/core/get-ts-morph-source-files.js.map +0 -1
- package/dist/fix/core/remove-named-import.d.ts +0 -1
- package/dist/fix/core/remove-named-import.js +0 -14
- package/dist/fix/core/remove-named-import.js.map +0 -1
- package/dist/fix/core/remove-symbol.d.ts +0 -1
- package/dist/fix/core/remove-symbol.js +0 -76
- package/dist/fix/core/remove-symbol.js.map +0 -1
- package/dist/fix/remove-sd-angular-symbol-names.d.ts +0 -1
- package/dist/fix/remove-sd-angular-symbol-names.js +0 -9
- package/dist/fix/remove-sd-angular-symbol-names.js.map +0 -1
- package/dist/fix/remove-unused-imports.d.ts +0 -1
- package/dist/fix/remove-unused-imports.js +0 -42
- package/dist/fix/remove-unused-imports.js.map +0 -1
- package/dist/fix/remove-unused-injects.d.ts +0 -1
- package/dist/fix/remove-unused-injects.js +0 -38
- package/dist/fix/remove-unused-injects.js.map +0 -1
- package/dist/fix/remove-unused-protected-readonly.d.ts +0 -1
- package/dist/fix/remove-unused-protected-readonly.js +0 -52
- package/dist/fix/remove-unused-protected-readonly.js.map +0 -1
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.d.ts +0 -9
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js +0 -89
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js.map +0 -1
- package/dist/pkg-builders/client/sd-client.build-runner.d.ts +0 -7
- package/dist/pkg-builders/client/sd-client.build-runner.js +0 -119
- package/dist/pkg-builders/client/sd-client.build-runner.js.map +0 -1
- package/dist/pkg-builders/client/sd-ng.bundler-context.d.ts +0 -22
- package/dist/pkg-builders/client/sd-ng.bundler-context.js +0 -91
- package/dist/pkg-builders/client/sd-ng.bundler-context.js.map +0 -1
- package/dist/pkg-builders/client/sd-ng.bundler.d.ts +0 -27
- package/dist/pkg-builders/client/sd-ng.bundler.js +0 -489
- package/dist/pkg-builders/client/sd-ng.bundler.js.map +0 -1
- package/dist/pkg-builders/client/sd-ng.plugin-creator.d.ts +0 -13
- package/dist/pkg-builders/client/sd-ng.plugin-creator.js +0 -223
- package/dist/pkg-builders/client/sd-ng.plugin-creator.js.map +0 -1
- package/dist/pkg-builders/commons/build-runner.base.d.ts +0 -29
- package/dist/pkg-builders/commons/build-runner.base.js +0 -114
- package/dist/pkg-builders/commons/build-runner.base.js.map +0 -1
- package/dist/pkg-builders/commons/scope-path.d.ts +0 -7
- package/dist/pkg-builders/commons/scope-path.js +0 -14
- package/dist/pkg-builders/commons/scope-path.js.map +0 -1
- package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.d.ts +0 -9
- package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.js +0 -134
- package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.js.map +0 -1
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.d.ts +0 -10
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.js +0 -61
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.js.map +0 -1
- package/dist/pkg-builders/lib/sd-js-lib.build-runner.d.ts +0 -8
- package/dist/pkg-builders/lib/sd-js-lib.build-runner.js +0 -50
- package/dist/pkg-builders/lib/sd-js-lib.build-runner.js.map +0 -1
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.d.ts +0 -7
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js +0 -41
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +0 -1
- package/dist/pkg-builders/lib/sd-ts-lib.builder.d.ts +0 -14
- package/dist/pkg-builders/lib/sd-ts-lib.builder.js +0 -65
- package/dist/pkg-builders/lib/sd-ts-lib.builder.js.map +0 -1
- package/dist/pkg-builders/sd-multi.build-runner.d.ts +0 -14
- package/dist/pkg-builders/sd-multi.build-runner.js +0 -228
- package/dist/pkg-builders/sd-multi.build-runner.js.map +0 -1
- package/dist/pkg-builders/server/sd-server.build-runner.d.ts +0 -7
- package/dist/pkg-builders/server/sd-server.build-runner.js +0 -264
- package/dist/pkg-builders/server/sd-server.build-runner.js.map +0 -1
- package/dist/pkg-builders/server/sd-server.bundler.d.ts +0 -22
- package/dist/pkg-builders/server/sd-server.bundler.js +0 -153
- package/dist/pkg-builders/server/sd-server.bundler.js.map +0 -1
- package/dist/pkg-builders/server/sd-server.plugin-creator.d.ts +0 -13
- package/dist/pkg-builders/server/sd-server.plugin-creator.js +0 -62
- package/dist/pkg-builders/server/sd-server.plugin-creator.js.map +0 -1
- package/dist/sd-cli-entry.d.ts +0 -2
- package/dist/sd-cli-entry.js +0 -263
- package/dist/sd-cli-entry.js.map +0 -1
- package/dist/sd-cli.d.ts +0 -2
- package/dist/sd-cli.js +0 -97
- package/dist/sd-cli.js.map +0 -1
- package/dist/ts-compiler/sd-dependency-analyzer.d.ts +0 -15
- package/dist/ts-compiler/sd-dependency-analyzer.js +0 -302
- package/dist/ts-compiler/sd-dependency-analyzer.js.map +0 -1
- package/dist/ts-compiler/sd-dependency-cache.d.ts +0 -43
- package/dist/ts-compiler/sd-dependency-cache.js +0 -310
- package/dist/ts-compiler/sd-dependency-cache.js.map +0 -1
- package/dist/ts-compiler/sd-style-bundler.d.ts +0 -16
- package/dist/ts-compiler/sd-style-bundler.js +0 -118
- package/dist/ts-compiler/sd-style-bundler.js.map +0 -1
- package/dist/ts-compiler/sd-ts-compiler.d.ts +0 -8
- package/dist/ts-compiler/sd-ts-compiler.js +0 -522
- package/dist/ts-compiler/sd-ts-compiler.js.map +0 -1
- package/dist/types/build-plugin.types.d.ts +0 -14
- package/dist/types/build-plugin.types.js +0 -2
- package/dist/types/build-plugin.types.js.map +0 -1
- package/dist/types/build-runner.types.d.ts +0 -10
- package/dist/types/build-runner.types.js +0 -2
- package/dist/types/build-runner.types.js.map +0 -1
- package/dist/types/build.types.d.ts +0 -15
- package/dist/types/build.types.js +0 -2
- package/dist/types/build.types.js.map +0 -1
- package/dist/types/common-configs.types.d.ts +0 -24
- package/dist/types/common-configs.types.js +0 -2
- package/dist/types/common-configs.types.js.map +0 -1
- package/dist/types/config.types.d.ts +0 -109
- package/dist/types/config.types.js +0 -2
- package/dist/types/config.types.js.map +0 -1
- package/dist/types/ts-compiler.types.d.ts +0 -37
- package/dist/types/ts-compiler.types.js +0 -2
- package/dist/types/ts-compiler.types.js.map +0 -1
- package/dist/types/worker.types.d.ts +0 -67
- package/dist/types/worker.types.js +0 -2
- package/dist/types/worker.types.js.map +0 -1
- package/dist/utils/sd-cli-convert-message.utils.d.ts +0 -21
- package/dist/utils/sd-cli-convert-message.utils.js +0 -137
- package/dist/utils/sd-cli-convert-message.utils.js.map +0 -1
- package/dist/utils/sd-cli-performance-time.d.ts +0 -9
- package/dist/utils/sd-cli-performance-time.js +0 -51
- package/dist/utils/sd-cli-performance-time.js.map +0 -1
- package/dist/workers/build-runner.worker.d.ts +0 -1
- package/dist/workers/build-runner.worker.js +0 -49
- package/dist/workers/build-runner.worker.js.map +0 -1
- package/dist/workers/server.worker.d.ts +0 -1
- package/dist/workers/server.worker.js +0 -50
- package/dist/workers/server.worker.js.map +0 -1
- package/src/pkg-builders/commons/build-runner.base.ts +0 -184
- package/src/pkg-builders/lib/sd-ts-lib.build-runner.ts +0 -57
- package/src/pkg-builders/sd-multi.build-runner.ts +0 -304
- package/src/types/build-runner.types.ts +0 -11
- package/src/types/ts-compiler.types.ts +0 -43
- package/src/types/worker.types.ts +0 -51
- /package/src/entry/{sd-cli-ai-command.ts → SdCliAiCommand.ts} +0 -0
- /package/src/entry/{sd-cli-postinstall.ts → SdCliPostinstall.ts} +0 -0
- /package/src/pkg-builders/client/{sd-cli-ng-routes.file-generator.ts → SdCliNgRoutesFileGenerator.ts} +0 -0
- /package/src/pkg-builders/lib/{sd-cli-index.file-generator.ts → SdCliIndexFileGenerator.ts} +0 -0
- /package/src/utils/{sd-cli-performance-time.ts → SdCliPerformanceTimer.ts} +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PathUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
+
import { SdBuildRunnerBase } from "../commons/SdBuildRunnerBase";
|
|
3
|
+
import { SdTsLibBuilder } from "./SdTsLibBuilder";
|
|
4
|
+
import { SdCliIndexFileGenerator } from "./SdCliIndexFileGenerator";
|
|
5
|
+
import { ISdBuildResult } from "../../types/build/ISdBuildResult";
|
|
6
|
+
import { SdCliDbContextFileGenerator } from "./SdCliDbContextFileGenerator";
|
|
7
|
+
|
|
8
|
+
export class SdTsLibBuildRunner extends SdBuildRunnerBase<"library"> {
|
|
9
|
+
protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdTsLibBuildRunner"]);
|
|
10
|
+
|
|
11
|
+
#builder?: SdTsLibBuilder;
|
|
12
|
+
|
|
13
|
+
protected override async _runAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
|
|
14
|
+
// 최초한번
|
|
15
|
+
if (!modifiedFileSet) {
|
|
16
|
+
if (!this._noEmit) {
|
|
17
|
+
// index
|
|
18
|
+
if (!this._pkgConf.noGenIndex) {
|
|
19
|
+
this._debug("GEN index.ts...");
|
|
20
|
+
new SdCliIndexFileGenerator().watch(this._pkgPath, this._pkgConf.polyfills);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// db-context
|
|
24
|
+
if (this._pkgConf.dbContext != null) {
|
|
25
|
+
this._debug(`GEN ${this._pkgConf.dbContext}.ts...`);
|
|
26
|
+
new SdCliDbContextFileGenerator().watch(this._pkgPath, this._pkgConf.dbContext);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
this._debug(`BUILD 준비...`);
|
|
31
|
+
this.#builder = new SdTsLibBuilder(
|
|
32
|
+
PathUtils.norm(this._pkgPath),
|
|
33
|
+
this._watch,
|
|
34
|
+
this._dev,
|
|
35
|
+
this._emitOnly ?? false,
|
|
36
|
+
this._noEmit ?? false,
|
|
37
|
+
this._scopePathSet,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
this._debug(`BUILD...`);
|
|
42
|
+
const buildResult = await this.#builder!.buildAsync(modifiedFileSet);
|
|
43
|
+
|
|
44
|
+
this._debug(`빌드 완료`);
|
|
45
|
+
return buildResult;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { SdCliConvertMessageUtils } from "../../utils/
|
|
2
|
+
import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
|
|
3
3
|
import { FsUtils, HashUtils, PathUtils, TNormPath } from "@simplysm/sd-core-node";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { SdTsCompiler } from "../../ts-compiler/SdTsCompiler";
|
|
5
|
+
import { ScopePathSet } from "../commons/ScopePathSet";
|
|
6
|
+
import { ISdBuildResult } from "../../types/build/ISdBuildResult";
|
|
7
7
|
|
|
8
8
|
export class SdTsLibBuilder {
|
|
9
9
|
#tsCompiler: SdTsCompiler;
|
|
@@ -11,30 +11,27 @@ export class SdTsLibBuilder {
|
|
|
11
11
|
|
|
12
12
|
constructor(
|
|
13
13
|
private readonly _pkgPath: TNormPath,
|
|
14
|
+
watch: boolean,
|
|
14
15
|
dev: boolean,
|
|
15
16
|
emitOnly: boolean,
|
|
16
17
|
noEmit: boolean,
|
|
17
|
-
|
|
18
|
+
scopePathSet: ScopePathSet,
|
|
18
19
|
) {
|
|
19
20
|
this.#tsCompiler = new SdTsCompiler({
|
|
20
21
|
pkgPath: this._pkgPath,
|
|
21
22
|
additionalOptions: { declaration: true },
|
|
23
|
+
isWatchMode: watch,
|
|
22
24
|
isDevMode: dev,
|
|
23
25
|
isEmitOnly: emitOnly,
|
|
24
26
|
isNoEmit: noEmit,
|
|
25
27
|
globalStyleFilePath: PathUtils.norm(this._pkgPath, "src/styles.scss"),
|
|
26
28
|
isForBundle: false,
|
|
27
|
-
|
|
29
|
+
scopePathSet,
|
|
28
30
|
});
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
async buildAsync(modifiedFileSet
|
|
32
|
-
|
|
33
|
-
affectedFileSet: Set<TNormPath>;
|
|
34
|
-
results: ISdBuildMessage[];
|
|
35
|
-
emitFileSet: Set<TNormPath>;
|
|
36
|
-
}> {
|
|
37
|
-
const tsCompileResult = await this.#tsCompiler.compileAsync(modifiedFileSet);
|
|
33
|
+
async buildAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
|
|
34
|
+
const tsCompileResult = await this.#tsCompiler.compileAsync(modifiedFileSet ?? new Set());
|
|
38
35
|
|
|
39
36
|
const emitFileSet = new Set<TNormPath>();
|
|
40
37
|
for (const emitFile of tsCompileResult.emitFileSet) {
|
|
@@ -81,9 +78,10 @@ export class SdTsLibBuilder {
|
|
|
81
78
|
);
|
|
82
79
|
|
|
83
80
|
return {
|
|
81
|
+
buildMessages: [...tsCompileResult.messages, ...styleResults],
|
|
82
|
+
|
|
84
83
|
watchFileSet: tsCompileResult.watchFileSet,
|
|
85
84
|
affectedFileSet: tsCompileResult.affectedFileSet,
|
|
86
|
-
results: [...tsCompileResult.messages, ...styleResults],
|
|
87
85
|
emitFileSet,
|
|
88
86
|
};
|
|
89
87
|
}
|
|
@@ -1,47 +1,40 @@
|
|
|
1
1
|
import { FsUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { javascript, StringUtils } from "@simplysm/sd-core-common";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { SdBuildRunnerBase } from "../commons/SdBuildRunnerBase";
|
|
5
|
+
import { SdServerBundler } from "./SdServerBundler";
|
|
6
|
+
import { ISdBuildResult } from "../../types/build/ISdBuildResult";
|
|
7
|
+
import { ITsConfig } from "../../types/common-config/ITsConfig";
|
|
8
|
+
import { INpmConfig } from "../../types/common-config/INpmConfig";
|
|
7
9
|
|
|
8
|
-
export class SdServerBuildRunner extends
|
|
9
|
-
protected override _logger = SdLogger.get(["simplysm", "sd-cli", "
|
|
10
|
+
export class SdServerBuildRunner extends SdBuildRunnerBase<"server"> {
|
|
11
|
+
protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdServerBuild2Runner"]);
|
|
10
12
|
|
|
11
13
|
#serverBundler?: SdServerBundler;
|
|
12
14
|
#extModules?: { name: string; exists: boolean }[];
|
|
13
15
|
|
|
14
|
-
protected override async _runAsync(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
noEmit: boolean,
|
|
18
|
-
modifiedFileSet?: Set<TNormPath>,
|
|
19
|
-
): Promise<IBuildRunnerRunResult> {
|
|
20
|
-
if (!dev) {
|
|
16
|
+
protected override async _runAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
|
|
17
|
+
// prod일때 각종 파일들 생성
|
|
18
|
+
if (!this._dev) {
|
|
21
19
|
await this.#generateProductionFilesAsync();
|
|
22
20
|
}
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
// 최초
|
|
23
|
+
if (!modifiedFileSet) {
|
|
24
|
+
if (!this._noEmit) {
|
|
26
25
|
this._debug("GEN .config...");
|
|
27
26
|
const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
|
|
28
27
|
FsUtils.writeFile(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
|
|
29
28
|
}
|
|
30
|
-
}
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
FsUtils.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.#serverBundler ??
|
|
41
|
-
new SdServerBundler({
|
|
42
|
-
dev,
|
|
43
|
-
emitOnly,
|
|
44
|
-
noEmit,
|
|
30
|
+
this._debug(`BUILD 준비...`);
|
|
31
|
+
const tsConfig = FsUtils.readJson(path.resolve(this._pkgPath, "tsconfig.json")) as ITsConfig;
|
|
32
|
+
this.#extModules = this.#extModules ?? (await this.#getExternalModulesAsync());
|
|
33
|
+
this.#serverBundler = new SdServerBundler({
|
|
34
|
+
watch: this._watch,
|
|
35
|
+
dev: this._dev,
|
|
36
|
+
emitOnly: this._emitOnly ?? false,
|
|
37
|
+
noEmit: this._noEmit ?? false,
|
|
45
38
|
pkgPath: this._pkgPath,
|
|
46
39
|
entryPoints: tsConfig.files
|
|
47
40
|
? tsConfig.files.map((item) => path.resolve(this._pkgPath, item))
|
|
@@ -50,24 +43,15 @@ export class SdServerBuildRunner extends BuildRunnerBase<"server"> {
|
|
|
50
43
|
...FsUtils.glob(path.resolve(this._pkgPath, "src/workers/*.ts")),
|
|
51
44
|
],
|
|
52
45
|
external: this.#extModules.map((item) => item.name),
|
|
53
|
-
|
|
46
|
+
scopePathSet: this._scopePathSet,
|
|
54
47
|
});
|
|
48
|
+
}
|
|
55
49
|
|
|
56
50
|
this._debug(`BUILD...`);
|
|
57
|
-
const bundleResult = await this.#serverBundler
|
|
58
|
-
|
|
59
|
-
//-- filePaths
|
|
60
|
-
const watchFileSet = new Set(
|
|
61
|
-
Array.from(bundleResult.watchFileSet).filter((item) => this._watchScopePathSet.inScope(item)),
|
|
62
|
-
);
|
|
51
|
+
const bundleResult = await this.#serverBundler!.bundleAsync(modifiedFileSet);
|
|
63
52
|
|
|
64
53
|
this._debug(`빌드 완료`);
|
|
65
|
-
return
|
|
66
|
-
watchFileSet,
|
|
67
|
-
affectedFileSet: bundleResult.affectedFileSet,
|
|
68
|
-
buildMessages: bundleResult.results,
|
|
69
|
-
emitFileSet: bundleResult.emitFileSet,
|
|
70
|
-
};
|
|
54
|
+
return bundleResult;
|
|
71
55
|
}
|
|
72
56
|
|
|
73
57
|
async #generateProductionFilesAsync() {
|
|
@@ -92,13 +76,6 @@ export class SdServerBuildRunner extends BuildRunnerBase<"server"> {
|
|
|
92
76
|
distNpmConfig.dependencies[dep] = "*";
|
|
93
77
|
}
|
|
94
78
|
|
|
95
|
-
// distNpmConfig.scripts = {};
|
|
96
|
-
// if (this._pkgConf.pm2 && !this._pkgConf.pm2.noStartScript) {
|
|
97
|
-
// distNpmConfig.scripts["start"] = "pm2 start pm2.config.cjs";
|
|
98
|
-
// distNpmConfig.scripts["stop"] = "pm2 stop pm2.config.cjs";
|
|
99
|
-
// distNpmConfig.scripts["delete"] = "pm2 delete pm2.config.cjs";
|
|
100
|
-
// }
|
|
101
|
-
|
|
102
79
|
distNpmConfig.volta = projNpmConf.volta;
|
|
103
80
|
|
|
104
81
|
FsUtils.writeJson(path.resolve(this._pkgPath, "dist/package.json"), distNpmConfig, {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import esbuild from "esbuild";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { FsUtils, HashUtils, PathUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
|
|
4
|
-
import { SdCliConvertMessageUtils } from "../../utils/
|
|
5
|
-
import {
|
|
6
|
-
import { ISdBuildMessage } from "../../types/build.types";
|
|
7
|
-
import { createSdServerPlugin } from "./sd-server.plugin-creator";
|
|
4
|
+
import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
|
|
5
|
+
import { createSdServerPlugin } from "./createSdServerPlugin";
|
|
8
6
|
import {
|
|
9
7
|
BuildOutputFile,
|
|
10
8
|
BuildOutputFileType,
|
|
11
9
|
} from "@angular/build/src/tools/esbuild/bundler-context";
|
|
12
10
|
import { convertOutputFile } from "@angular/build/src/tools/esbuild/utils";
|
|
13
11
|
import { resolveAssets } from "@angular/build/src/utils/resolve-assets";
|
|
14
|
-
import { ScopePathSet } from "../commons/
|
|
12
|
+
import { ScopePathSet } from "../commons/ScopePathSet";
|
|
13
|
+
import { ISdCliServerPluginResultCache } from "../../types/plugin/ISdCliServerPluginResultCache";
|
|
14
|
+
import { ISdBuildResult } from "../../types/build/ISdBuildResult";
|
|
15
15
|
|
|
16
16
|
export class SdServerBundler {
|
|
17
17
|
#logger = SdLogger.get(["simplysm", "sd-cli", "SdServerBundler"]);
|
|
@@ -25,22 +25,18 @@ export class SdServerBundler {
|
|
|
25
25
|
|
|
26
26
|
constructor(
|
|
27
27
|
private readonly _opt: {
|
|
28
|
+
watch: boolean;
|
|
28
29
|
dev: boolean;
|
|
29
30
|
emitOnly: boolean;
|
|
30
31
|
noEmit: boolean;
|
|
31
32
|
pkgPath: TNormPath;
|
|
32
33
|
entryPoints: string[];
|
|
33
34
|
external?: string[];
|
|
34
|
-
|
|
35
|
+
scopePathSet: ScopePathSet;
|
|
35
36
|
},
|
|
36
37
|
) {}
|
|
37
38
|
|
|
38
|
-
async bundleAsync(modifiedFileSet?: Set<TNormPath>): Promise<{
|
|
39
|
-
watchFileSet: Set<TNormPath>;
|
|
40
|
-
affectedFileSet: Set<TNormPath>;
|
|
41
|
-
results: ISdBuildMessage[];
|
|
42
|
-
emitFileSet: Set<TNormPath>;
|
|
43
|
-
}> {
|
|
39
|
+
async bundleAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
|
|
44
40
|
this.#modifiedFileSet.clear();
|
|
45
41
|
if (modifiedFileSet) {
|
|
46
42
|
this.#modifiedFileSet.adds(...modifiedFileSet);
|
|
@@ -109,25 +105,30 @@ const __dirname = __path__.dirname(__filename);`.trim(),
|
|
|
109
105
|
plugins: [
|
|
110
106
|
createSdServerPlugin({
|
|
111
107
|
modifiedFileSet: this.#modifiedFileSet,
|
|
108
|
+
watch: this._opt.watch,
|
|
112
109
|
dev: this._opt.dev,
|
|
113
110
|
emitOnly: this._opt.emitOnly,
|
|
114
111
|
noEmit: this._opt.noEmit,
|
|
115
112
|
pkgPath: this._opt.pkgPath,
|
|
116
113
|
result: this.#resultCache,
|
|
117
|
-
|
|
114
|
+
scopePathSet: this._opt.scopePathSet,
|
|
118
115
|
}),
|
|
119
116
|
],
|
|
120
117
|
});
|
|
121
118
|
}
|
|
122
119
|
|
|
123
|
-
let
|
|
124
|
-
|
|
120
|
+
let esbuildResult: esbuild.BuildResult | esbuild.BuildFailure;
|
|
121
|
+
esbuildResult = await this.#context.rebuild();
|
|
125
122
|
|
|
126
123
|
if (this._opt.noEmit) {
|
|
127
124
|
return {
|
|
125
|
+
buildMessages: SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(
|
|
126
|
+
esbuildResult,
|
|
127
|
+
this._opt.pkgPath,
|
|
128
|
+
),
|
|
129
|
+
|
|
128
130
|
watchFileSet: this.#resultCache.watchFileSet!,
|
|
129
131
|
affectedFileSet: this.#resultCache.affectedFileSet!,
|
|
130
|
-
results: [],
|
|
131
132
|
emitFileSet: new Set<TNormPath>(),
|
|
132
133
|
};
|
|
133
134
|
} else {
|
|
@@ -135,8 +136,9 @@ const __dirname = __path__.dirname(__filename);`.trim(),
|
|
|
135
136
|
|
|
136
137
|
try {
|
|
137
138
|
const outputFiles: BuildOutputFile[] =
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
esbuildResult.outputFiles?.map((file) =>
|
|
140
|
+
convertOutputFile(file, BuildOutputFileType.Root),
|
|
141
|
+
) ?? [];
|
|
140
142
|
|
|
141
143
|
for (const outputFile of outputFiles) {
|
|
142
144
|
const distFilePath = PathUtils.norm(this._opt.pkgPath, outputFile.path);
|
|
@@ -171,7 +173,7 @@ const __dirname = __path__.dirname(__filename);`.trim(),
|
|
|
171
173
|
}
|
|
172
174
|
}
|
|
173
175
|
} catch (err) {
|
|
174
|
-
|
|
176
|
+
esbuildResult = err;
|
|
175
177
|
for (const e of err.errors) {
|
|
176
178
|
if (e.detail != null) {
|
|
177
179
|
this.#logger.error(e.detail);
|
|
@@ -180,12 +182,13 @@ const __dirname = __path__.dirname(__filename);`.trim(),
|
|
|
180
182
|
}
|
|
181
183
|
|
|
182
184
|
return {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
results: SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(
|
|
186
|
-
result,
|
|
185
|
+
buildMessages: SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(
|
|
186
|
+
esbuildResult,
|
|
187
187
|
this._opt.pkgPath,
|
|
188
188
|
),
|
|
189
|
+
|
|
190
|
+
watchFileSet: this.#resultCache.watchFileSet!,
|
|
191
|
+
affectedFileSet: this.#resultCache.affectedFileSet!,
|
|
189
192
|
emitFileSet: emitFileSet,
|
|
190
193
|
};
|
|
191
194
|
}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import esbuild from "esbuild";
|
|
2
|
-
import { SdCliConvertMessageUtils } from "../../utils/
|
|
3
|
-
import { ISdCliServerPluginResultCache } from "../../types/build-plugin.types";
|
|
2
|
+
import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
|
|
4
3
|
import { PathUtils, TNormPath } from "@simplysm/sd-core-node";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { SdTsCompiler } from "../../ts-compiler/SdTsCompiler";
|
|
5
|
+
import { ScopePathSet } from "../commons/ScopePathSet";
|
|
6
|
+
import { ISdCliServerPluginResultCache } from "../../types/plugin/ISdCliServerPluginResultCache";
|
|
7
|
+
import { ISdTsCompilerResult } from "../../types/build/ISdTsCompilerResult";
|
|
8
8
|
|
|
9
9
|
export function createSdServerPlugin(conf: {
|
|
10
10
|
pkgPath: TNormPath;
|
|
11
|
+
watch: boolean;
|
|
11
12
|
dev: boolean;
|
|
12
13
|
emitOnly: boolean;
|
|
13
14
|
noEmit: boolean;
|
|
14
15
|
modifiedFileSet: Set<TNormPath>;
|
|
15
16
|
result: ISdCliServerPluginResultCache;
|
|
16
|
-
|
|
17
|
+
scopePathSet: ScopePathSet;
|
|
17
18
|
}): esbuild.Plugin {
|
|
18
19
|
return {
|
|
19
20
|
name: "sd-server-compile",
|
|
@@ -21,11 +22,12 @@ export function createSdServerPlugin(conf: {
|
|
|
21
22
|
const tsCompiler = new SdTsCompiler({
|
|
22
23
|
pkgPath: conf.pkgPath,
|
|
23
24
|
additionalOptions: { declaration: false },
|
|
25
|
+
isWatchMode: conf.watch,
|
|
24
26
|
isDevMode: conf.dev,
|
|
25
27
|
isNoEmit: conf.noEmit,
|
|
26
28
|
isEmitOnly: conf.emitOnly,
|
|
27
29
|
isForBundle: true,
|
|
28
|
-
|
|
30
|
+
scopePathSet: conf.scopePathSet,
|
|
29
31
|
});
|
|
30
32
|
|
|
31
33
|
let tsCompileResult: ISdTsCompilerResult;
|
package/src/sd-cli-entry.ts
CHANGED
|
@@ -6,12 +6,12 @@ import { SdLogger, SdLoggerSeverity } from "@simplysm/sd-core-node";
|
|
|
6
6
|
import { EventEmitter } from "events";
|
|
7
7
|
import yargs from "yargs";
|
|
8
8
|
import { hideBin } from "yargs/helpers";
|
|
9
|
-
import { SdCliAiCommand } from "./entry/
|
|
10
|
-
import { SdCliCordova } from "./entry/
|
|
11
|
-
import { SdCliElectron } from "./entry/
|
|
12
|
-
import { SdCliLocalUpdate } from "./entry/
|
|
13
|
-
import { SdCliPostinstall } from "./entry/
|
|
14
|
-
import { SdCliProject } from "./entry/
|
|
9
|
+
import { SdCliAiCommand } from "./entry/SdCliAiCommand";
|
|
10
|
+
import { SdCliCordova } from "./entry/SdCliCordova";
|
|
11
|
+
import { SdCliElectron } from "./entry/SdCliElectron";
|
|
12
|
+
import { SdCliLocalUpdate } from "./entry/SdCliLocalUpdate";
|
|
13
|
+
import { SdCliPostinstall } from "./entry/SdCliPostinstall";
|
|
14
|
+
import { SdCliProject } from "./entry/SdCliProject";
|
|
15
15
|
import convertPrivateToHash from "./fix/convert-private-to-hash";
|
|
16
16
|
import removeSdAngularSymbolNames from "./fix/remove-sd-angular-symbol-names";
|
|
17
17
|
import convertSdAngularSymbolNames from "./fix/convert-sd-angular-symbol-names";
|
|
@@ -88,11 +88,6 @@ await yargs(hideBin(process.argv))
|
|
|
88
88
|
array: true,
|
|
89
89
|
describe: "수행할 패키지 설정",
|
|
90
90
|
},
|
|
91
|
-
inspects: {
|
|
92
|
-
string: true,
|
|
93
|
-
array: true,
|
|
94
|
-
describe: "크롬 inspect를 수행할 패키지 설정",
|
|
95
|
-
},
|
|
96
91
|
emitOnly: {
|
|
97
92
|
type: "boolean",
|
|
98
93
|
describe: "emit만 수행",
|
|
@@ -133,7 +128,6 @@ await yargs(hideBin(process.argv))
|
|
|
133
128
|
}),
|
|
134
129
|
async (argv) => {
|
|
135
130
|
await SdCliProject.buildAsync(argv);
|
|
136
|
-
process.exit(0);
|
|
137
131
|
},
|
|
138
132
|
)
|
|
139
133
|
.command(
|
package/src/sd-cli.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
/* eslint-disable no-console */
|
|
4
|
-
|
|
5
3
|
import { exec, spawn } from "child_process";
|
|
6
4
|
import os from "os";
|
|
7
5
|
import path from "path";
|
|
@@ -67,6 +65,7 @@ function configureProcessorAffinityAndPriority(pid: number) {
|
|
|
67
65
|
|
|
68
66
|
exec(command, (err) => {
|
|
69
67
|
if (err) {
|
|
68
|
+
// eslint-disable-next-line no-console
|
|
70
69
|
console.error("Affinity 또는 우선순위 설정 실패:", err.message);
|
|
71
70
|
}
|
|
72
71
|
});
|
|
@@ -91,19 +90,6 @@ function calculateAffinityMask(cpuCount: number): string {
|
|
|
91
90
|
return "0x" + mask.toString(16).toUpperCase();
|
|
92
91
|
}
|
|
93
92
|
|
|
94
|
-
// ProcessorAffinity 마스크 계산 (뒤 코어 빼기)
|
|
95
|
-
// function calculateAffinityMask(cpuCount: number): string {
|
|
96
|
-
// const exclude = cpuCount <= 1 ? 0 : Math.ceil(cpuCount / 8); // 8개당 1개씩 뺌
|
|
97
|
-
// const usable = cpuCount - exclude;
|
|
98
|
-
//
|
|
99
|
-
// if (usable <= 0) {
|
|
100
|
-
// throw new Error(`CPU 사용 가능 개수가 0 이하입니다 (총: ${cpuCount}, 제외: ${exclude})`);
|
|
101
|
-
// }
|
|
102
|
-
//
|
|
103
|
-
// const maskValue = (1 << usable) - 1;
|
|
104
|
-
// return "0x" + maskValue.toString(16).toUpperCase();
|
|
105
|
-
// }
|
|
106
|
-
|
|
107
93
|
async function spawnWaitAsync(command: string, args: string[]) {
|
|
108
94
|
await new Promise<void>((resolve) => {
|
|
109
95
|
const child = spawn(command, args, {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
import {
|
|
2
|
+
import { SdDepCache } from "./SdDepCache";
|
|
3
3
|
import { PathUtils, TNormPath } from "@simplysm/sd-core-node";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import { NgtscProgram } from "@angular/compiler-cli";
|
|
6
|
-
import { ScopePathSet } from "../pkg-builders/commons/
|
|
6
|
+
import { ScopePathSet } from "../pkg-builders/commons/ScopePathSet";
|
|
7
7
|
|
|
8
|
-
export class
|
|
8
|
+
export class SdDepAnalyzer {
|
|
9
9
|
static analyze(
|
|
10
10
|
program: ts.Program,
|
|
11
11
|
compilerHost: ts.CompilerHost,
|
|
12
12
|
scopePathSet: ScopePathSet,
|
|
13
13
|
cache: {
|
|
14
|
-
dep:
|
|
14
|
+
dep: SdDepCache;
|
|
15
15
|
type: WeakMap<ts.Node, ts.Type | undefined>;
|
|
16
16
|
prop: WeakMap<ts.Type, Map<string, ts.Symbol | undefined>>;
|
|
17
17
|
declFiles: WeakMap<ts.Symbol, TNormPath[]>;
|
|
@@ -162,8 +162,6 @@ export class SdDependencyAnalyzer {
|
|
|
162
162
|
return s;
|
|
163
163
|
};
|
|
164
164
|
|
|
165
|
-
// const declFilesCache = new WeakMap<ts.Symbol, TNormPath[]>();
|
|
166
|
-
|
|
167
165
|
const getDeclFileNPaths = (sym: ts.Symbol | undefined): TNormPath[] => {
|
|
168
166
|
if (!sym) return [];
|
|
169
167
|
const c = cache.declFiles.get(sym);
|
|
@@ -328,8 +326,6 @@ export class SdDependencyAnalyzer {
|
|
|
328
326
|
ts.forEachChild(sf, visit);
|
|
329
327
|
};
|
|
330
328
|
|
|
331
|
-
// const ngToOrgCache = new Map<TNormPath, ts.SourceFile>();
|
|
332
|
-
|
|
333
329
|
const getOrgSourceFile = (sf: ts.SourceFile) => {
|
|
334
330
|
if (sf.fileName.endsWith(".ngtypecheck.ts")) {
|
|
335
331
|
const sfNPath = PathUtils.norm(sf.fileName);
|
|
@@ -362,7 +358,7 @@ export class SdDependencyAnalyzer {
|
|
|
362
358
|
static analyzeAngularResources(
|
|
363
359
|
ngProgram: NgtscProgram,
|
|
364
360
|
scopePathSet: ScopePathSet,
|
|
365
|
-
depCache:
|
|
361
|
+
depCache: SdDepCache,
|
|
366
362
|
) {
|
|
367
363
|
for (const sf of ngProgram.getTsProgram().getSourceFiles()) {
|
|
368
364
|
const fileNPath = PathUtils.norm(sf.fileName);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TNormPath } from "@simplysm/sd-core-node";
|
|
2
2
|
|
|
3
|
-
export class
|
|
3
|
+
export class SdDepCache {
|
|
4
4
|
/**
|
|
5
5
|
* 각 파일이 export한 심볼 집합 (예: export const A → "A")
|
|
6
6
|
*/
|
|
@@ -59,13 +59,6 @@ export class SdDependencyCache {
|
|
|
59
59
|
return [nPath];
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
* 전체 추적된 파일 경로를 반환
|
|
64
|
-
*/
|
|
65
|
-
// getFiles(): Set<TNormPath> {
|
|
66
|
-
// return new Set<TNormPath>([...this.#collectedCache.keys(), ...this.revDepCache.keys()]);
|
|
67
|
-
// }
|
|
68
|
-
|
|
69
62
|
/**
|
|
70
63
|
* 분석이 완료된 파일로 표시
|
|
71
64
|
*/
|
|
@@ -174,63 +167,6 @@ export class SdDependencyCache {
|
|
|
174
167
|
}
|
|
175
168
|
}
|
|
176
169
|
|
|
177
|
-
/**
|
|
178
|
-
* 변경된 파일 경로 집합으로부터 영향을 받는 전체 파일 집합을 계산
|
|
179
|
-
*/
|
|
180
|
-
/*getAffectedFileSet(modifiedNPathSet: Set<TNormPath>): Set<TNormPath> {
|
|
181
|
-
const visited = new Set<string>();
|
|
182
|
-
const result = new Set<TNormPath>();
|
|
183
|
-
|
|
184
|
-
const queue: { fileNPath: TNormPath; exportSymbol: string | undefined }[] = [];
|
|
185
|
-
|
|
186
|
-
const enqueue = (fileNPath: TNormPath, exportSymbol: string | undefined) => {
|
|
187
|
-
const key = `${fileNPath}#${exportSymbol}`;
|
|
188
|
-
if (!visited.has(key)) {
|
|
189
|
-
visited.add(key);
|
|
190
|
-
queue.push({ fileNPath, exportSymbol });
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
for (const modifiedNPath of modifiedNPathSet) {
|
|
195
|
-
for (const path of this.#getRelatedNPaths(modifiedNPath)) {
|
|
196
|
-
result.add(path);
|
|
197
|
-
const exportSymbols = this.#getExportSymbols(path);
|
|
198
|
-
if (exportSymbols.size === 0) {
|
|
199
|
-
enqueue(path, undefined);
|
|
200
|
-
} else {
|
|
201
|
-
for (const symbol of exportSymbols) {
|
|
202
|
-
enqueue(path, symbol);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
while (queue.length > 0) {
|
|
209
|
-
const curr = queue.shift()!;
|
|
210
|
-
const revDepInfoMap = this._revDepCache.get(curr.fileNPath);
|
|
211
|
-
if (!revDepInfoMap) continue;
|
|
212
|
-
|
|
213
|
-
for (const [revDepFileNPath, revDepInfo] of revDepInfoMap) {
|
|
214
|
-
if (curr.exportSymbol != null) {
|
|
215
|
-
const hasImportSymbol = revDepInfo === 0 || revDepInfo.has(curr.exportSymbol);
|
|
216
|
-
if (hasImportSymbol) {
|
|
217
|
-
result.add(revDepFileNPath);
|
|
218
|
-
const exportSymbol = this.#convertImportSymbolToExportSymbol(
|
|
219
|
-
revDepFileNPath,
|
|
220
|
-
curr.fileNPath,
|
|
221
|
-
curr.exportSymbol,
|
|
222
|
-
);
|
|
223
|
-
enqueue(revDepFileNPath, exportSymbol);
|
|
224
|
-
}
|
|
225
|
-
} else {
|
|
226
|
-
result.add(revDepFileNPath);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
return result;
|
|
232
|
-
}*/
|
|
233
|
-
|
|
234
170
|
getAffectedFileMap(modifiedNPathSet: Set<TNormPath>): Map<TNormPath, Set<TNormPath>> {
|
|
235
171
|
const resultMap = new Map<TNormPath, Set<TNormPath>>();
|
|
236
172
|
|
|
@@ -292,8 +228,6 @@ export class SdDependencyCache {
|
|
|
292
228
|
* 주어진 파일들 및 그 영향 범위에 해당하는 모든 캐시를 무효화
|
|
293
229
|
*/
|
|
294
230
|
invalidates(fileNPathSet: Set<TNormPath>) {
|
|
295
|
-
// const affectedFileMap = this.getAffectedFileMap(fileNPathSet);
|
|
296
|
-
|
|
297
231
|
const revDepCacheChanged = new Set<TNormPath>();
|
|
298
232
|
|
|
299
233
|
for (const fileNPath of fileNPathSet) {
|
|
@@ -367,74 +301,4 @@ export class SdDependencyCache {
|
|
|
367
301
|
this.#exportSymbolCache.set(fileNPath, result);
|
|
368
302
|
return result;
|
|
369
303
|
}
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* 변경된 파일로부터 영향을 받는 전체 트리를 반환
|
|
373
|
-
* - 의존 관계를 시각화 및 구조적으로 추적할 수 있도록 트리 형태로 구성
|
|
374
|
-
*/
|
|
375
|
-
// getAffectedFileTree(modifiedNPathSet: Set<TNormPath>): ISdAffectedFileTreeNode[] {
|
|
376
|
-
// const visited = new Set<string>();
|
|
377
|
-
// const nodeMap = new Map<string, ISdAffectedFileTreeNode>();
|
|
378
|
-
//
|
|
379
|
-
// const buildTree = (
|
|
380
|
-
// fileNPath: TNormPath,
|
|
381
|
-
// exportSymbol: string | undefined,
|
|
382
|
-
// ): ISdAffectedFileTreeNode => {
|
|
383
|
-
// const key = `${fileNPath}#${exportSymbol ?? "*"}`;
|
|
384
|
-
// if (nodeMap.has(key)) return nodeMap.get(key)!;
|
|
385
|
-
//
|
|
386
|
-
// visited.add(key);
|
|
387
|
-
//
|
|
388
|
-
// const node: ISdAffectedFileTreeNode = {
|
|
389
|
-
// fileNPath,
|
|
390
|
-
// children: [],
|
|
391
|
-
// };
|
|
392
|
-
// nodeMap.set(key, node);
|
|
393
|
-
//
|
|
394
|
-
// const revDepInfoMap = this.revDepCache.get(fileNPath);
|
|
395
|
-
// if (!revDepInfoMap) return node;
|
|
396
|
-
//
|
|
397
|
-
// for (const [revDepFileNPath, revDepInfo] of revDepInfoMap.entries()) {
|
|
398
|
-
// const hasImportSymbol =
|
|
399
|
-
// exportSymbol == null || revDepInfo === 0 || revDepInfo.has(exportSymbol);
|
|
400
|
-
// if (!hasImportSymbol) continue;
|
|
401
|
-
//
|
|
402
|
-
// const nextExportSymbol =
|
|
403
|
-
// exportSymbol != null
|
|
404
|
-
// ? this.#convertImportSymbolToExportSymbol(revDepFileNPath, fileNPath, exportSymbol)
|
|
405
|
-
// : undefined;
|
|
406
|
-
//
|
|
407
|
-
// const childKey = `${revDepFileNPath}#${nextExportSymbol ?? "*"}`;
|
|
408
|
-
// if (visited.has(childKey)) continue;
|
|
409
|
-
//
|
|
410
|
-
// const childNode = buildTree(revDepFileNPath, nextExportSymbol);
|
|
411
|
-
// node.children.push(childNode);
|
|
412
|
-
// }
|
|
413
|
-
//
|
|
414
|
-
// return node;
|
|
415
|
-
// };
|
|
416
|
-
//
|
|
417
|
-
// const result: ISdAffectedFileTreeNode[] = [];
|
|
418
|
-
//
|
|
419
|
-
// for (const modifiedNPath of modifiedNPathSet) {
|
|
420
|
-
// for (const path of this.#getRelatedNPaths(modifiedNPath)) {
|
|
421
|
-
// result.push(buildTree(path, undefined)); // root는 symbol상관없이
|
|
422
|
-
// /*const exportSymbols = this.#getExportSymbols(path);
|
|
423
|
-
// if (exportSymbols.size === 0) {
|
|
424
|
-
// result.push(buildTree(path, undefined));
|
|
425
|
-
// } else {
|
|
426
|
-
// for (const symbol of exportSymbols) {
|
|
427
|
-
// result.push(buildTree(path, symbol));
|
|
428
|
-
// }
|
|
429
|
-
// }*/
|
|
430
|
-
// }
|
|
431
|
-
// }
|
|
432
|
-
//
|
|
433
|
-
// return result;
|
|
434
|
-
// }
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
export interface ISdAffectedFileTreeNode {
|
|
438
|
-
fileNPath: TNormPath;
|
|
439
|
-
children: ISdAffectedFileTreeNode[];
|
|
440
304
|
}
|