@simplysm/sd-cli 12.13.21 → 12.13.35
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-ai-command.js → SdCliAiCommand.js} +1 -1
- package/dist/entry/SdCliAiCommand.js.map +1 -0
- package/dist/entry/{sd-cli-cordova.d.ts → SdCliCordova.d.ts} +1 -1
- package/dist/entry/{sd-cli-cordova.js → SdCliCordova.js} +1 -1
- package/dist/entry/SdCliCordova.js.map +1 -0
- package/dist/entry/{sd-cli-electron.d.ts → SdCliElectron.d.ts} +1 -1
- package/dist/entry/{sd-cli-electron.js → SdCliElectron.js} +2 -2
- package/dist/entry/SdCliElectron.js.map +1 -0
- package/dist/entry/{sd-cli-local-update.js → SdCliLocalUpdate.js} +4 -4
- package/dist/entry/SdCliLocalUpdate.js.map +1 -0
- package/dist/entry/{sd-cli-postinstall.js → SdCliPostinstall.js} +1 -1
- package/dist/entry/SdCliPostinstall.js.map +1 -0
- package/dist/entry/{sd-cli-project.d.ts → SdCliProject.d.ts} +0 -1
- package/dist/entry/{sd-cli-project.js → SdCliProject.js} +41 -64
- package/dist/entry/SdCliProject.js.map +1 -0
- package/dist/fix/core/convert-symbol.js +22 -13
- package/dist/fix/core/convert-symbol.js.map +1 -1
- package/dist/fix/remove-unused-protected-readonly.js +7 -1
- package/dist/fix/remove-unused-protected-readonly.js.map +1 -1
- package/dist/pkg-builders/SdProjectBuildRunner.d.ts +18 -0
- package/dist/pkg-builders/SdProjectBuildRunner.js +235 -0
- package/dist/pkg-builders/SdProjectBuildRunner.js.map +1 -0
- package/dist/pkg-builders/client/{sd-cli-ng-routes.file-generator.js → SdCliNgRoutesFileGenerator.js} +1 -1
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js.map +1 -0
- package/dist/pkg-builders/client/SdClientBuildRunner.d.ts +8 -0
- package/dist/pkg-builders/client/{sd-client.build-runner.js → SdClientBuildRunner.js} +27 -31
- package/dist/pkg-builders/client/SdClientBuildRunner.js.map +1 -0
- package/dist/pkg-builders/client/{sd-ng.bundler.d.ts → SdNgBundler.d.ts} +6 -10
- package/dist/pkg-builders/client/{sd-ng.bundler.js → SdNgBundler.js} +12 -11
- package/dist/pkg-builders/client/SdNgBundler.js.map +1 -0
- package/dist/pkg-builders/client/{sd-ng.bundler-context.d.ts → SdNgBundlerContext.d.ts} +1 -1
- package/dist/pkg-builders/client/{sd-ng.bundler-context.js → SdNgBundlerContext.js} +3 -4
- package/dist/pkg-builders/client/SdNgBundlerContext.js.map +1 -0
- package/dist/pkg-builders/client/{sd-ng.plugin-creator.d.ts → createSdNgPlugin.d.ts} +4 -3
- package/dist/pkg-builders/client/{sd-ng.plugin-creator.js → createSdNgPlugin.js} +6 -86
- package/dist/pkg-builders/client/createSdNgPlugin.js.map +1 -0
- package/dist/pkg-builders/commons/{scope-path.d.ts → ScopePathSet.d.ts} +1 -1
- package/dist/pkg-builders/commons/{scope-path.js → ScopePathSet.js} +3 -3
- package/dist/pkg-builders/commons/ScopePathSet.js.map +1 -0
- package/dist/pkg-builders/commons/SdBuildRunnerBase.d.ts +20 -0
- package/dist/pkg-builders/commons/SdBuildRunnerBase.js +30 -0
- package/dist/pkg-builders/commons/SdBuildRunnerBase.js.map +1 -0
- package/dist/pkg-builders/lib/{sd-cli-db-context.file-generator.js → SdCliDbContextFileGenerator.js} +1 -1
- package/dist/pkg-builders/lib/SdCliDbContextFileGenerator.js.map +1 -0
- package/dist/pkg-builders/lib/{sd-cli-index.file-generator.js → SdCliIndexFileGenerator.js} +1 -1
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js.map +1 -0
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.d.ts +8 -0
- package/dist/pkg-builders/lib/{sd-js-lib.build-runner.js → SdJsLibBuildRunner.js} +11 -16
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js.map +1 -0
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.d.ts +8 -0
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js +36 -0
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js.map +1 -0
- package/dist/pkg-builders/lib/SdTsLibBuilder.d.ts +9 -0
- package/dist/pkg-builders/lib/{sd-ts-lib.builder.js → SdTsLibBuilder.js} +8 -8
- package/dist/pkg-builders/lib/SdTsLibBuilder.js.map +1 -0
- package/dist/pkg-builders/server/SdServerBuildRunner.d.ts +8 -0
- package/dist/pkg-builders/server/{sd-server.build-runner.js → SdServerBuildRunner.js} +30 -45
- package/dist/pkg-builders/server/SdServerBuildRunner.js.map +1 -0
- package/dist/pkg-builders/server/SdServerBundler.d.ts +18 -0
- package/dist/pkg-builders/server/{sd-server.bundler.js → SdServerBundler.js} +11 -11
- package/dist/pkg-builders/server/SdServerBundler.js.map +1 -0
- package/dist/pkg-builders/server/{sd-server.plugin-creator.d.ts → createSdServerPlugin.d.ts} +4 -3
- package/dist/pkg-builders/server/{sd-server.plugin-creator.js → createSdServerPlugin.js} +5 -4
- package/dist/pkg-builders/server/createSdServerPlugin.js.map +1 -0
- package/dist/sd-cli-entry.js +6 -12
- package/dist/sd-cli-entry.js.map +1 -1
- package/dist/sd-cli.js +1 -13
- package/dist/sd-cli.js.map +1 -1
- package/dist/ts-compiler/{sd-dependency-analyzer.d.ts → SdDepAnalyzer.d.ts} +5 -5
- package/dist/ts-compiler/{sd-dependency-analyzer.js → SdDepAnalyzer.js} +2 -4
- package/dist/ts-compiler/SdDepAnalyzer.js.map +1 -0
- package/dist/ts-compiler/{sd-dependency-cache.d.ts → SdDepCache.d.ts} +1 -11
- package/dist/ts-compiler/{sd-dependency-cache.js → SdDepCache.js} +2 -65
- package/dist/ts-compiler/SdDepCache.js.map +1 -0
- package/dist/ts-compiler/{sd-style-bundler.d.ts → SdStyleBundler.d.ts} +4 -4
- package/dist/ts-compiler/{sd-style-bundler.js → SdStyleBundler.js} +5 -5
- package/dist/ts-compiler/SdStyleBundler.js.map +1 -0
- package/dist/ts-compiler/{sd-ts-compiler.d.ts → SdTsCompiler.d.ts} +3 -2
- package/dist/ts-compiler/{sd-ts-compiler.js → SdTsCompiler.js} +33 -148
- package/dist/ts-compiler/SdTsCompiler.js.map +1 -0
- package/dist/types/{build.types.d.ts → build/ISdBuildMessage.d.ts} +0 -5
- package/dist/types/build/ISdBuildMessage.js +2 -0
- package/dist/types/build/ISdBuildMessage.js.map +1 -0
- package/dist/types/build/ISdBuildResult.d.ts +8 -0
- package/dist/types/build/ISdBuildResult.js +2 -0
- package/dist/types/build/ISdBuildResult.js.map +1 -0
- package/dist/types/build/ISdTsCompilerOptions.d.ts +13 -0
- package/dist/types/build/ISdTsCompilerOptions.js +2 -0
- package/dist/types/build/ISdTsCompilerOptions.js.map +1 -0
- package/dist/types/build/ISdTsCompilerResult.d.ts +14 -0
- package/dist/types/build/ISdTsCompilerResult.js +2 -0
- package/dist/types/build/ISdTsCompilerResult.js.map +1 -0
- package/dist/types/build/TStylesheetBundlingResult.d.ts +12 -0
- package/dist/types/build/TStylesheetBundlingResult.js +2 -0
- package/dist/types/build/TStylesheetBundlingResult.js.map +1 -0
- package/dist/types/{common-configs.types.d.ts → common-config/INpmConfig.d.ts} +0 -7
- package/dist/types/common-config/INpmConfig.js +2 -0
- package/dist/types/common-config/INpmConfig.js.map +1 -0
- package/dist/types/common-config/ITsConfig.d.ts +7 -0
- package/dist/types/common-config/ITsConfig.js +2 -0
- package/dist/types/common-config/ITsConfig.js.map +1 -0
- package/dist/types/{config.types.d.ts → config/ISdProjectConfig.d.ts} +0 -1
- package/dist/types/config/ISdProjectConfig.js +2 -0
- package/dist/types/config/ISdProjectConfig.js.map +1 -0
- package/dist/types/plugin/ISdCliNgPluginResultCache.d.ts +8 -0
- package/dist/types/plugin/ISdCliNgPluginResultCache.js +2 -0
- package/dist/types/plugin/ISdCliNgPluginResultCache.js.map +1 -0
- package/dist/types/{build-plugin.types.d.ts → plugin/ISdCliServerPluginResultCache.d.ts} +0 -6
- package/dist/types/plugin/ISdCliServerPluginResultCache.js +2 -0
- package/dist/types/plugin/ISdCliServerPluginResultCache.js.map +1 -0
- package/dist/types/worker/ISdBuildRunnerWorkerType.d.ts +23 -0
- package/dist/types/worker/ISdBuildRunnerWorkerType.js +2 -0
- package/dist/types/worker/ISdBuildRunnerWorkerType.js.map +1 -0
- package/dist/types/worker/IServerWorkerType.d.ts +17 -0
- package/dist/types/worker/IServerWorkerType.js +2 -0
- package/dist/types/worker/IServerWorkerType.js.map +1 -0
- package/dist/utils/{sd-cli-convert-message.utils.d.ts → SdCliConvertMessageUtils.d.ts} +1 -1
- package/dist/utils/{sd-cli-convert-message.utils.js → SdCliConvertMessageUtils.js} +4 -2
- package/dist/utils/SdCliConvertMessageUtils.js.map +1 -0
- package/dist/utils/{sd-cli-performance-time.js → SdCliPerformanceTimer.js} +1 -1
- package/dist/utils/SdCliPerformanceTimer.js.map +1 -0
- package/dist/{entry/utils → utils}/loadProjConfAsync.d.ts +1 -1
- package/dist/utils/loadProjConfAsync.js.map +1 -0
- package/dist/workers/build-runner.worker.js +13 -23
- package/dist/workers/build-runner.worker.js.map +1 -1
- package/dist/workers/server.worker.js +4 -4
- package/dist/workers/server.worker.js.map +1 -1
- 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/fix/core/convert-symbol.ts +35 -16
- package/src/fix/remove-unused-protected-readonly.ts +7 -1
- package/src/pkg-builders/SdProjectBuildRunner.ts +354 -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 -15
- 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} +43 -175
- 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 +14 -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.js.map +0 -1
- package/dist/entry/sd-cli-cordova.js.map +0 -1
- package/dist/entry/sd-cli-electron.js.map +0 -1
- package/dist/entry/sd-cli-local-update.js.map +0 -1
- package/dist/entry/sd-cli-postinstall.js.map +0 -1
- package/dist/entry/sd-cli-project.js.map +0 -1
- package/dist/entry/utils/loadProjConfAsync.js.map +0 -1
- 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.map +0 -1
- package/dist/pkg-builders/client/sd-ng.bundler-context.js.map +0 -1
- package/dist/pkg-builders/client/sd-ng.bundler.js.map +0 -1
- 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.js.map +0 -1
- 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.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.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.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.map +0 -1
- package/dist/pkg-builders/server/sd-server.bundler.d.ts +0 -22
- package/dist/pkg-builders/server/sd-server.bundler.js.map +0 -1
- package/dist/pkg-builders/server/sd-server.plugin-creator.js.map +0 -1
- package/dist/ts-compiler/sd-dependency-analyzer.js.map +0 -1
- package/dist/ts-compiler/sd-dependency-cache.js.map +0 -1
- package/dist/ts-compiler/sd-style-bundler.js.map +0 -1
- package/dist/ts-compiler/sd-ts-compiler.js.map +0 -1
- 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.js +0 -2
- package/dist/types/build.types.js.map +0 -1
- package/dist/types/common-configs.types.js +0 -2
- package/dist/types/common-configs.types.js.map +0 -1
- 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.js.map +0 -1
- package/dist/utils/sd-cli-performance-time.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/dist/entry/{sd-cli-ai-command.d.ts → SdCliAiCommand.d.ts} +0 -0
- /package/dist/entry/{sd-cli-local-update.d.ts → SdCliLocalUpdate.d.ts} +0 -0
- /package/dist/entry/{sd-cli-postinstall.d.ts → SdCliPostinstall.d.ts} +0 -0
- /package/dist/pkg-builders/client/{sd-cli-ng-routes.file-generator.d.ts → SdCliNgRoutesFileGenerator.d.ts} +0 -0
- /package/dist/pkg-builders/lib/{sd-cli-db-context.file-generator.d.ts → SdCliDbContextFileGenerator.d.ts} +0 -0
- /package/dist/pkg-builders/lib/{sd-cli-index.file-generator.d.ts → SdCliIndexFileGenerator.d.ts} +0 -0
- /package/dist/utils/{sd-cli-performance-time.d.ts → SdCliPerformanceTimer.d.ts} +0 -0
- /package/dist/{entry/utils → utils}/loadProjConfAsync.js +0 -0
- /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
|
@@ -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
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PathUtils, TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
-
import { TStylesheetBundlingResult } from "../types/ts-compiler.types";
|
|
3
2
|
import { ComponentStylesheetBundler } from "@angular/build/src/tools/esbuild/angular/component-stylesheets";
|
|
4
3
|
import { transformSupportedBrowsersToTargets } from "@angular/build/src/tools/esbuild/utils";
|
|
5
4
|
import browserslist from "browserslist";
|
|
6
|
-
import { ScopePathSet } from "../pkg-builders/commons/
|
|
5
|
+
import { ScopePathSet } from "../pkg-builders/commons/ScopePathSet";
|
|
6
|
+
import { TStylesheetBundlingResult } from "../types/build/TStylesheetBundlingResult";
|
|
7
7
|
|
|
8
8
|
export class SdStyleBundler {
|
|
9
9
|
#ngStyleBundler: ComponentStylesheetBundler;
|
|
@@ -14,7 +14,7 @@ export class SdStyleBundler {
|
|
|
14
14
|
constructor(
|
|
15
15
|
private readonly _pkgPath: TNormPath,
|
|
16
16
|
private readonly _isDevMode: boolean,
|
|
17
|
-
private readonly
|
|
17
|
+
private readonly _scopePathSet: ScopePathSet,
|
|
18
18
|
) {
|
|
19
19
|
this.#ngStyleBundler = new ComponentStylesheetBundler(
|
|
20
20
|
{
|
|
@@ -68,8 +68,8 @@ export class SdStyleBundler {
|
|
|
68
68
|
|
|
69
69
|
for (const referencedFile of result.referencedFiles ?? []) {
|
|
70
70
|
if (
|
|
71
|
-
!this.
|
|
72
|
-
!this.
|
|
71
|
+
!this._scopePathSet.inScope(fileNPath) ||
|
|
72
|
+
!this._scopePathSet.inScope(PathUtils.norm(referencedFile))
|
|
73
73
|
)
|
|
74
74
|
continue;
|
|
75
75
|
|
|
@@ -5,14 +5,15 @@ import { StringUtils } from "@simplysm/sd-core-common";
|
|
|
5
5
|
import { NgtscProgram, OptimizeFor } from "@angular/compiler-cli";
|
|
6
6
|
import { AngularCompilerHost } from "@angular/build/src/tools/angular/angular-host";
|
|
7
7
|
import { replaceBootstrap } from "@angular/build/src/tools/angular/transformers/jit-bootstrap-transformer";
|
|
8
|
-
import { SdCliPerformanceTimer } from "../utils/
|
|
9
|
-
import { SdCliConvertMessageUtils } from "../utils/
|
|
10
|
-
import { ISdTsCompilerResult, SdTsCompilerOptions } from "../types/ts-compiler.types";
|
|
8
|
+
import { SdCliPerformanceTimer } from "../utils/SdCliPerformanceTimer";
|
|
9
|
+
import { SdCliConvertMessageUtils } from "../utils/SdCliConvertMessageUtils";
|
|
11
10
|
import { createWorkerTransformer } from "@angular/build/src/tools/angular/transformers/web-worker-transformer";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
11
|
+
import { SdDepCache } from "./SdDepCache";
|
|
12
|
+
import { SdDepAnalyzer } from "./SdDepAnalyzer";
|
|
14
13
|
import { FlatESLint } from "eslint/use-at-your-own-risk";
|
|
15
|
-
import { SdStyleBundler } from "./
|
|
14
|
+
import { SdStyleBundler } from "./SdStyleBundler";
|
|
15
|
+
import { ISdTsCompilerOptions } from "../types/build/ISdTsCompilerOptions";
|
|
16
|
+
import { ISdTsCompilerResult } from "../types/build/ISdTsCompilerResult";
|
|
16
17
|
|
|
17
18
|
export class SdTsCompiler {
|
|
18
19
|
#logger = SdLogger.get(["simplysm", "sd-cli", "SdTsCompiler"]);
|
|
@@ -26,7 +27,7 @@ export class SdTsCompiler {
|
|
|
26
27
|
|
|
27
28
|
// 빌드정보 캐싱
|
|
28
29
|
#cache = {
|
|
29
|
-
dep: new
|
|
30
|
+
dep: new SdDepCache(),
|
|
30
31
|
type: new WeakMap<ts.Node, ts.Type | undefined>(),
|
|
31
32
|
prop: new WeakMap<ts.Type, Map<string, ts.Symbol | undefined>>(),
|
|
32
33
|
declFiles: new WeakMap<ts.Symbol, TNormPath[]>(),
|
|
@@ -43,7 +44,7 @@ export class SdTsCompiler {
|
|
|
43
44
|
|
|
44
45
|
#perf!: SdCliPerformanceTimer;
|
|
45
46
|
|
|
46
|
-
constructor(private readonly _opt:
|
|
47
|
+
constructor(private readonly _opt: ISdTsCompilerOptions) {
|
|
47
48
|
this.#debug("초기화 중...");
|
|
48
49
|
|
|
49
50
|
const tsconfigPath = path.resolve(this._opt.pkgPath, "tsconfig.json");
|
|
@@ -54,7 +55,7 @@ export class SdTsCompiler {
|
|
|
54
55
|
this.#styleBundler = new SdStyleBundler(
|
|
55
56
|
this._opt.pkgPath,
|
|
56
57
|
this._opt.isDevMode,
|
|
57
|
-
this._opt.
|
|
58
|
+
this._opt.scopePathSet,
|
|
58
59
|
);
|
|
59
60
|
}
|
|
60
61
|
}
|
|
@@ -171,23 +172,6 @@ export class SdTsCompiler {
|
|
|
171
172
|
context.resourceFile != null ? PathUtils.norm(context.resourceFile) : undefined,
|
|
172
173
|
);
|
|
173
174
|
|
|
174
|
-
/*if (!styleBundleResult.cached && !StringUtils.isNullOrEmpty(styleBundleResult.contents)) {
|
|
175
|
-
const relPath = path.relative(
|
|
176
|
-
path.resolve(this._opt.pkgPath, "src"),
|
|
177
|
-
context.containingFile,
|
|
178
|
-
);
|
|
179
|
-
const outAbsPath = PathUtils.norm(
|
|
180
|
-
compilerOptions.outDir!,
|
|
181
|
-
relPath.replace(/\.ts$/, ".css"),
|
|
182
|
-
);
|
|
183
|
-
const cache = this.#emittedFilesCacheMap.getOrCreate(
|
|
184
|
-
PathUtils.norm(context.containingFile),
|
|
185
|
-
[],
|
|
186
|
-
);
|
|
187
|
-
cache.remove((item) => item.outAbsPath === outAbsPath);
|
|
188
|
-
cache.push({ outAbsPath, text: styleBundleResult.contents });
|
|
189
|
-
}*/
|
|
190
|
-
|
|
191
175
|
return StringUtils.isNullOrEmpty(styleBundleResult.contents)
|
|
192
176
|
? null
|
|
193
177
|
: { content: styleBundleResult.contents };
|
|
@@ -240,7 +224,7 @@ export class SdTsCompiler {
|
|
|
240
224
|
|
|
241
225
|
const tsconfig = this.#parseTsConfig();
|
|
242
226
|
|
|
243
|
-
if (modifiedFileSet.size !== 0) {
|
|
227
|
+
if (modifiedFileSet.size !== 0 && this._opt.isWatchMode) {
|
|
244
228
|
this.#debug(`캐시 무효화 및 초기화 중...`);
|
|
245
229
|
|
|
246
230
|
// this._perf.run("캐시 무효화 및 초기화", () => {
|
|
@@ -313,17 +297,12 @@ export class SdTsCompiler {
|
|
|
313
297
|
});
|
|
314
298
|
}
|
|
315
299
|
|
|
316
|
-
if (!this._opt.isEmitOnly) {
|
|
300
|
+
if (!this._opt.isEmitOnly && this._opt.isWatchMode) {
|
|
317
301
|
this.#debug(`새 의존성 분석 중...`);
|
|
318
302
|
|
|
319
303
|
this.#perf.run("새 의존성 분석", () => {
|
|
320
304
|
// SdTsDependencyAnalyzer를 통해 의존성 분석 및 SdDepCache 업데이트
|
|
321
|
-
|
|
322
|
-
this.#program!,
|
|
323
|
-
compilerHost,
|
|
324
|
-
this._opt.watchScopePathSet,
|
|
325
|
-
this.#cache,
|
|
326
|
-
);
|
|
305
|
+
SdDepAnalyzer.analyze(this.#program!, compilerHost, this._opt.scopePathSet, this.#cache);
|
|
327
306
|
});
|
|
328
307
|
|
|
329
308
|
this.#debug(`새 의존성 분석(Angular) 중...`);
|
|
@@ -331,9 +310,9 @@ export class SdTsCompiler {
|
|
|
331
310
|
// Angular 리소스 의존성 추가
|
|
332
311
|
if (this.#ngProgram) {
|
|
333
312
|
this.#perf.run("새 의존성 분석(Angular)", () => {
|
|
334
|
-
|
|
313
|
+
SdDepAnalyzer.analyzeAngularResources(
|
|
335
314
|
this.#ngProgram!,
|
|
336
|
-
this._opt.
|
|
315
|
+
this._opt.scopePathSet,
|
|
337
316
|
this.#cache.dep,
|
|
338
317
|
);
|
|
339
318
|
});
|
|
@@ -341,13 +320,11 @@ export class SdTsCompiler {
|
|
|
341
320
|
}
|
|
342
321
|
|
|
343
322
|
const allFiles = this.#program!.getSourceFiles().map((item) => PathUtils.norm(item.fileName));
|
|
344
|
-
const watchFileSet = new Set(
|
|
345
|
-
allFiles.filter((item) => this._opt.watchScopePathSet.inScope(item)),
|
|
346
|
-
);
|
|
323
|
+
const watchFileSet = new Set(allFiles.filter((item) => this._opt.scopePathSet.inScope(item)));
|
|
347
324
|
|
|
348
325
|
let affectedFileSet: Set<TNormPath>;
|
|
349
326
|
if (modifiedFileSet.size === 0) {
|
|
350
|
-
affectedFileSet = new Set(allFiles);
|
|
327
|
+
affectedFileSet = new Set(allFiles.filter((item) => this._opt.scopePathSet.inScope(item)));
|
|
351
328
|
} else {
|
|
352
329
|
const affectedFileMap = this.#cache.dep.getAffectedFileMap(modifiedFileSet);
|
|
353
330
|
this.#debug("영향받은 파일:", affectedFileMap);
|
|
@@ -391,40 +368,35 @@ export class SdTsCompiler {
|
|
|
391
368
|
}
|
|
392
369
|
|
|
393
370
|
async #buildGlobalStyleAsync() {
|
|
371
|
+
if (!this.#isForAngular) return;
|
|
372
|
+
|
|
394
373
|
//-- global style
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
)
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
.relative(path.resolve(this._opt.pkgPath, "src"), this._opt.globalStyleFilePath!)
|
|
418
|
-
.replace(/\.scss$/, ".css"),
|
|
419
|
-
),
|
|
420
|
-
text: stylesheetBundlingResult.contents ?? "",
|
|
421
|
-
});
|
|
374
|
+
const globalStyleFilePath = PathUtils.norm(this._opt.pkgPath, "src/styles.scss");
|
|
375
|
+
if (this.#emittedFilesCacheMap.has(globalStyleFilePath)) return;
|
|
376
|
+
if (!FsUtils.exists(globalStyleFilePath)) return;
|
|
377
|
+
|
|
378
|
+
this.#debug(`전역 스타일 번들링 중...`);
|
|
379
|
+
|
|
380
|
+
await this.#perf.run("전역 스타일 번들링", async () => {
|
|
381
|
+
const data = await FsUtils.readFileAsync(globalStyleFilePath);
|
|
382
|
+
const stylesheetBundlingResult = await this.#styleBundler!.bundleAsync(
|
|
383
|
+
data,
|
|
384
|
+
globalStyleFilePath,
|
|
385
|
+
globalStyleFilePath,
|
|
386
|
+
);
|
|
387
|
+
const emitFileInfos = this.#emittedFilesCacheMap.getOrCreate(globalStyleFilePath, []);
|
|
388
|
+
emitFileInfos.push({
|
|
389
|
+
outAbsPath: PathUtils.norm(
|
|
390
|
+
this._opt.pkgPath,
|
|
391
|
+
path
|
|
392
|
+
.relative(path.resolve(this._opt.pkgPath, "src"), globalStyleFilePath)
|
|
393
|
+
.replace(/\.scss$/, ".css"),
|
|
394
|
+
),
|
|
395
|
+
text: stylesheetBundlingResult.contents ?? "",
|
|
422
396
|
});
|
|
397
|
+
});
|
|
423
398
|
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
return undefined;
|
|
399
|
+
return globalStyleFilePath;
|
|
428
400
|
}
|
|
429
401
|
|
|
430
402
|
#build(prepareResult: IPrepareResult) {
|
|
@@ -459,8 +431,6 @@ export class SdTsCompiler {
|
|
|
459
431
|
continue;
|
|
460
432
|
}
|
|
461
433
|
|
|
462
|
-
// this.#debug(`get diagnostics of file ${affectedFile}...`);
|
|
463
|
-
|
|
464
434
|
this.#perf.run("개별 파일 진단 수집", () => {
|
|
465
435
|
diagnostics.push(
|
|
466
436
|
...this.#program!.getSyntacticDiagnostics(affectedSourceFile),
|
|
@@ -507,8 +477,6 @@ export class SdTsCompiler {
|
|
|
507
477
|
return relPath.replace(/\.ts$/, "").replaceAll("\\", "/") + ".js";
|
|
508
478
|
}),
|
|
509
479
|
);
|
|
510
|
-
|
|
511
|
-
// (transformers.before ??= []).push(this.#createExternalizeComponentStylesTransformer());
|
|
512
480
|
}
|
|
513
481
|
|
|
514
482
|
this.#debug(`파일 출력 중...`);
|
|
@@ -595,106 +563,6 @@ export class SdTsCompiler {
|
|
|
595
563
|
};
|
|
596
564
|
}
|
|
597
565
|
|
|
598
|
-
/*#createExternalizeComponentStylesTransformer() {
|
|
599
|
-
const f = ts.factory;
|
|
600
|
-
|
|
601
|
-
function upsertEnsureStyleHelper(sf: ts.SourceFile): ts.SourceFile {
|
|
602
|
-
const importTarget = "./" + path.basename(sf.fileName).replace(/\.ts$/, ".css");
|
|
603
|
-
|
|
604
|
-
// 이미 동일한 import가 있으면 스킵
|
|
605
|
-
if (
|
|
606
|
-
sf.statements.some(
|
|
607
|
-
(s) =>
|
|
608
|
-
ts.isImportDeclaration(s) &&
|
|
609
|
-
ts.isStringLiteral(s.moduleSpecifier) &&
|
|
610
|
-
s.moduleSpecifier.text === importTarget,
|
|
611
|
-
)
|
|
612
|
-
) {
|
|
613
|
-
return sf;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
const importDecl = f.createImportDeclaration(
|
|
617
|
-
undefined,
|
|
618
|
-
undefined,
|
|
619
|
-
f.createStringLiteral(importTarget),
|
|
620
|
-
);
|
|
621
|
-
|
|
622
|
-
return f.updateSourceFile(sf, [importDecl, ...sf.statements]);
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
const removeStyleProp = (node: ts.ClassDeclaration) => {
|
|
626
|
-
const allDecorators = ts.getDecorators(node);
|
|
627
|
-
if (!allDecorators || allDecorators.length === 0) return node;
|
|
628
|
-
|
|
629
|
-
const decoratorsUpdated = allDecorators.map((dec) => {
|
|
630
|
-
if (!ts.isCallExpression(dec.expression)) return dec;
|
|
631
|
-
const call = dec.expression;
|
|
632
|
-
if (!ts.isIdentifier(call.expression) || call.expression.text !== "Component") return dec;
|
|
633
|
-
if (call.arguments.length !== 1) return dec;
|
|
634
|
-
const arg = call.arguments[0];
|
|
635
|
-
if (!ts.isObjectLiteralExpression(arg)) return dec;
|
|
636
|
-
|
|
637
|
-
const filteredProps = arg.properties.filter((p) => {
|
|
638
|
-
if (!ts.isPropertyAssignment(p)) return true;
|
|
639
|
-
const name = p.name;
|
|
640
|
-
const key = ts.isIdentifier(name)
|
|
641
|
-
? name.text
|
|
642
|
-
: ts.isStringLiteralLike(name)
|
|
643
|
-
? name.text
|
|
644
|
-
: undefined;
|
|
645
|
-
return !(key === "styles" || key === "styleUrls");
|
|
646
|
-
});
|
|
647
|
-
|
|
648
|
-
const newArg = f.updateObjectLiteralExpression(arg, filteredProps);
|
|
649
|
-
const newCall = f.updateCallExpression(call, call.expression, call.typeArguments, [newArg]);
|
|
650
|
-
return f.updateDecorator(dec, newCall);
|
|
651
|
-
});
|
|
652
|
-
|
|
653
|
-
const existingModifiers = node.modifiers ?? [];
|
|
654
|
-
const modifiersWithoutOldDecos = existingModifiers.filter((m) => !ts.isDecorator(m));
|
|
655
|
-
const newModifiers: readonly ts.ModifierLike[] = [
|
|
656
|
-
...decoratorsUpdated,
|
|
657
|
-
...modifiersWithoutOldDecos,
|
|
658
|
-
];
|
|
659
|
-
|
|
660
|
-
const newNode = f.updateClassDeclaration(
|
|
661
|
-
node,
|
|
662
|
-
newModifiers,
|
|
663
|
-
node.name,
|
|
664
|
-
node.typeParameters,
|
|
665
|
-
node.heritageClauses,
|
|
666
|
-
node.members,
|
|
667
|
-
);
|
|
668
|
-
|
|
669
|
-
return f.updateClassDeclaration(
|
|
670
|
-
newNode,
|
|
671
|
-
newNode.modifiers,
|
|
672
|
-
newNode.name,
|
|
673
|
-
newNode.typeParameters,
|
|
674
|
-
newNode.heritageClauses,
|
|
675
|
-
newNode.members,
|
|
676
|
-
);
|
|
677
|
-
};
|
|
678
|
-
|
|
679
|
-
return (ctx: ts.TransformationContext) => {
|
|
680
|
-
return (sf: ts.SourceFile) => {
|
|
681
|
-
const has = this.#styleBundler!.getResultCache().get(PathUtils.norm(sf.fileName));
|
|
682
|
-
if (!has) return sf;
|
|
683
|
-
|
|
684
|
-
const realSf = upsertEnsureStyleHelper(sf);
|
|
685
|
-
|
|
686
|
-
function visitor(node: ts.Node): ts.Node {
|
|
687
|
-
if (ts.isClassDeclaration(node) && Boolean(ts.getDecorators(node)?.length)) {
|
|
688
|
-
return removeStyleProp(node);
|
|
689
|
-
}
|
|
690
|
-
return ts.visitEachChild(node, visitor, ctx);
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
return ts.visitNode(realSf, visitor) as ts.SourceFile;
|
|
694
|
-
};
|
|
695
|
-
};
|
|
696
|
-
}*/
|
|
697
|
-
|
|
698
566
|
#convertOutputToReal(filePath: string, distPath: string, text: string) {
|
|
699
567
|
let realFilePath = PathUtils.norm(filePath);
|
|
700
568
|
let realText = text;
|