@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
|
@@ -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);
|
|
@@ -459,8 +436,6 @@ export class SdTsCompiler {
|
|
|
459
436
|
continue;
|
|
460
437
|
}
|
|
461
438
|
|
|
462
|
-
// this.#debug(`get diagnostics of file ${affectedFile}...`);
|
|
463
|
-
|
|
464
439
|
this.#perf.run("개별 파일 진단 수집", () => {
|
|
465
440
|
diagnostics.push(
|
|
466
441
|
...this.#program!.getSyntacticDiagnostics(affectedSourceFile),
|
|
@@ -507,8 +482,6 @@ export class SdTsCompiler {
|
|
|
507
482
|
return relPath.replace(/\.ts$/, "").replaceAll("\\", "/") + ".js";
|
|
508
483
|
}),
|
|
509
484
|
);
|
|
510
|
-
|
|
511
|
-
// (transformers.before ??= []).push(this.#createExternalizeComponentStylesTransformer());
|
|
512
485
|
}
|
|
513
486
|
|
|
514
487
|
this.#debug(`파일 출력 중...`);
|
|
@@ -595,106 +568,6 @@ export class SdTsCompiler {
|
|
|
595
568
|
};
|
|
596
569
|
}
|
|
597
570
|
|
|
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
571
|
#convertOutputToReal(filePath: string, distPath: string, text: string) {
|
|
699
572
|
let realFilePath = PathUtils.norm(filePath);
|
|
700
573
|
let realText = text;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { TNormPath } from "@simplysm/sd-core-node";
|
|
2
2
|
|
|
3
|
-
export interface ISdBuildRunnerResult {
|
|
4
|
-
affectedFilePathSet: Set<TNormPath>;
|
|
5
|
-
buildMessages: ISdBuildMessage[];
|
|
6
|
-
emitFileSet: Set<TNormPath>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
3
|
export interface ISdBuildMessage {
|
|
10
4
|
filePath: TNormPath | undefined;
|
|
11
5
|
line: number | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
+
import { ISdBuildMessage } from "./ISdBuildMessage";
|
|
3
|
+
|
|
4
|
+
export interface ISdBuildResult {
|
|
5
|
+
buildMessages: ISdBuildMessage[];
|
|
6
|
+
watchFileSet: Set<TNormPath>;
|
|
7
|
+
affectedFileSet: Set<TNormPath>;
|
|
8
|
+
emitFileSet: Set<TNormPath>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
import { ScopePathSet } from "../../pkg-builders/commons/ScopePathSet";
|
|
4
|
+
|
|
5
|
+
export interface ISdTsCompilerOptions {
|
|
6
|
+
pkgPath: TNormPath;
|
|
7
|
+
additionalOptions: ts.CompilerOptions;
|
|
8
|
+
isForBundle: boolean;
|
|
9
|
+
isWatchMode: boolean;
|
|
10
|
+
isDevMode: boolean;
|
|
11
|
+
isEmitOnly: boolean;
|
|
12
|
+
isNoEmit: boolean;
|
|
13
|
+
scopePathSet: ScopePathSet;
|
|
14
|
+
globalStyleFilePath?: TNormPath;
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ISdBuildMessage } from "./ISdBuildMessage";
|
|
2
|
+
import { TNormPath } from "@simplysm/sd-core-node";
|
|
3
|
+
import { TStylesheetBundlingResult } from "./TStylesheetBundlingResult";
|
|
4
|
+
|
|
5
|
+
export interface ISdTsCompilerResult {
|
|
6
|
+
messages: ISdBuildMessage[];
|
|
7
|
+
stylesheetBundlingResultMap: Map<TNormPath, TStylesheetBundlingResult>;
|
|
8
|
+
emittedFilesCacheMap: Map<TNormPath, { outAbsPath?: TNormPath; text: string }[]>;
|
|
9
|
+
emitFileSet: Set<TNormPath>;
|
|
10
|
+
watchFileSet: Set<TNormPath>;
|
|
11
|
+
affectedFileSet: Set<TNormPath>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import esbuild from "esbuild";
|
|
2
|
+
|
|
3
|
+
export type TStylesheetBundlingResult =
|
|
4
|
+
| {
|
|
5
|
+
errors: esbuild.PartialMessage[];
|
|
6
|
+
warnings: esbuild.PartialMessage[];
|
|
7
|
+
contents?: string;
|
|
8
|
+
}
|
|
9
|
+
| {
|
|
10
|
+
errors: undefined;
|
|
11
|
+
warnings: esbuild.PartialMessage[];
|
|
12
|
+
metafile: esbuild.Metafile;
|
|
13
|
+
outputFiles: esbuild.OutputFile[];
|
|
14
|
+
contents: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import esbuild from "esbuild";
|
|
2
|
+
import { TNormPath } from "@simplysm/sd-core-node";
|
|
3
|
+
|
|
4
|
+
export interface ISdCliNgPluginResultCache {
|
|
5
|
+
watchFileSet?: Set<TNormPath>;
|
|
6
|
+
affectedFileSet?: Set<TNormPath>;
|
|
7
|
+
outputFiles?: esbuild.OutputFile[];
|
|
8
|
+
metafile?: esbuild.Metafile;
|
|
9
|
+
}
|
|
@@ -7,10 +7,3 @@ export interface ISdCliServerPluginResultCache {
|
|
|
7
7
|
outputFiles?: esbuild.OutputFile[];
|
|
8
8
|
metafile?: esbuild.Metafile;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
export interface ISdCliNgPluginResultCache {
|
|
12
|
-
watchFileSet?: Set<TNormPath>;
|
|
13
|
-
affectedFileSet?: Set<TNormPath>;
|
|
14
|
-
outputFiles?: esbuild.OutputFile[];
|
|
15
|
-
metafile?: esbuild.Metafile;
|
|
16
|
-
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ISdBuildResult } from "../build/ISdBuildResult";
|
|
2
|
+
import { ISdWorkerType, TNormPath } from "@simplysm/sd-core-node";
|
|
3
|
+
import { ISdProjectConfig } from "../config/ISdProjectConfig";
|
|
4
|
+
|
|
5
|
+
export interface ISdBuildRunnerWorkerType extends ISdWorkerType {
|
|
6
|
+
methods: {
|
|
7
|
+
initialize: {
|
|
8
|
+
params: [ISdBuildRunnerInitializeRequest];
|
|
9
|
+
returnType: void;
|
|
10
|
+
};
|
|
11
|
+
rebuild: { params: [Set<TNormPath>?]; returnType: ISdBuildResult };
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ISdBuildRunnerInitializeRequest {
|
|
16
|
+
pkgPath: TNormPath;
|
|
17
|
+
projConf: ISdProjectConfig;
|
|
18
|
+
|
|
19
|
+
// watch
|
|
20
|
+
watch?: boolean;
|
|
21
|
+
emitOnly?: boolean;
|
|
22
|
+
noEmit?: boolean;
|
|
23
|
+
scopePathSet?: Set<TNormPath>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface IServerWorkerType {
|
|
2
|
+
methods: {
|
|
3
|
+
listen: { params: [string | number]; returnType: number };
|
|
4
|
+
setPathProxy: { params: [Record<string, string>]; returnType: void };
|
|
5
|
+
broadcastReload: { params: [string | undefined, Set<string>]; returnType: void };
|
|
6
|
+
};
|
|
7
|
+
events: {};
|
|
8
|
+
}
|
|
@@ -3,7 +3,7 @@ import os from "os";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { PartialMessage } from "esbuild";
|
|
5
5
|
import { ESLint } from "eslint";
|
|
6
|
-
import { ISdBuildMessage } from "../types/build
|
|
6
|
+
import { ISdBuildMessage } from "../types/build/ISdBuildMessage";
|
|
7
7
|
import { PathUtils } from "@simplysm/sd-core-node";
|
|
8
8
|
|
|
9
9
|
export class SdCliConvertMessageUtils {
|
|
@@ -23,7 +23,9 @@ export class SdCliConvertMessageUtils {
|
|
|
23
23
|
|
|
24
24
|
const filePath = diag.file ? PathUtils.norm(path.resolve(diag.file.fileName)) : undefined;
|
|
25
25
|
const position =
|
|
26
|
-
diag.file && diag.start !== undefined
|
|
26
|
+
diag.file && diag.start !== undefined
|
|
27
|
+
? diag.file.getLineAndCharacterOfPosition(diag.start)
|
|
28
|
+
: undefined;
|
|
27
29
|
const line = position ? position.line + 1 : undefined;
|
|
28
30
|
const char = position ? position.character + 1 : undefined;
|
|
29
31
|
|
|
@@ -47,7 +49,8 @@ export class SdCliConvertMessageUtils {
|
|
|
47
49
|
orgPath: string,
|
|
48
50
|
): ISdBuildMessage[] {
|
|
49
51
|
const convertFn = (msg: PartialMessage, severity: "error" | "warning") => {
|
|
50
|
-
const filePath =
|
|
52
|
+
const filePath =
|
|
53
|
+
msg.location?.file != null ? PathUtils.norm(orgPath, msg.location.file) : undefined;
|
|
51
54
|
const line = msg.location?.line;
|
|
52
55
|
const char = msg.location?.column;
|
|
53
56
|
const code = msg.text!.slice(0, msg.text!.indexOf(":"));
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { pathToFileURL } from "url";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import { ISdProjectConfig } from "
|
|
3
|
+
import { ISdProjectConfig } from "../types/config/ISdProjectConfig";
|
|
4
4
|
|
|
5
|
-
export async function loadProjConfAsync(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export async function loadProjConfAsync(
|
|
6
|
+
rootPath: string,
|
|
7
|
+
dev: boolean,
|
|
8
|
+
opt: {
|
|
9
|
+
config: string;
|
|
10
|
+
options?: string[];
|
|
11
|
+
},
|
|
12
|
+
) {
|
|
9
13
|
const filePath = path.resolve(rootPath, opt.config);
|
|
10
14
|
const imported = await import(pathToFileURL(filePath).href);
|
|
11
15
|
return imported.default(dev, opt.options ?? []) as ISdProjectConfig;
|
|
12
|
-
}
|
|
16
|
+
}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { TSdBuildRunnerWorkerType } from "../types/worker.types";
|
|
9
|
-
import { ISdBuildRunnerWorkerRequest } from "../types/build-runner.types";
|
|
1
|
+
import {
|
|
2
|
+
createSdWorker,
|
|
3
|
+
FsUtils,
|
|
4
|
+
SdLogger,
|
|
5
|
+
SdLoggerSeverity,
|
|
6
|
+
TNormPath,
|
|
7
|
+
} from "@simplysm/sd-core-node";
|
|
10
8
|
import { EventEmitter } from "events";
|
|
9
|
+
import path from "path";
|
|
10
|
+
import {
|
|
11
|
+
ISdBuildRunnerInitializeRequest,
|
|
12
|
+
ISdBuildRunnerWorkerType,
|
|
13
|
+
} from "../types/worker/ISdBuildRunnerWorkerType";
|
|
14
|
+
import { SdBuildRunnerBase } from "../pkg-builders/commons/SdBuildRunnerBase";
|
|
15
|
+
import { SdServerBuildRunner } from "../pkg-builders/server/SdServerBuildRunner";
|
|
16
|
+
import { SdClientBuildRunner } from "../pkg-builders/client/SdClientBuildRunner";
|
|
17
|
+
import { SdTsLibBuildRunner } from "../pkg-builders/lib/SdTsLibBuildRunner";
|
|
18
|
+
import { SdJsLibBuildRunner } from "../pkg-builders/lib/SdJsLibBuildRunner";
|
|
11
19
|
|
|
12
20
|
Error.stackTraceLimit = Infinity;
|
|
13
21
|
EventEmitter.defaultMaxListeners = 0;
|
|
@@ -24,8 +32,10 @@ if (process.env["SD_DEBUG"] != null) {
|
|
|
24
32
|
});
|
|
25
33
|
}
|
|
26
34
|
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
let buildRunner: SdBuildRunnerBase<any>;
|
|
36
|
+
|
|
37
|
+
createSdWorker<ISdBuildRunnerWorkerType>({
|
|
38
|
+
initialize(req: ISdBuildRunnerInitializeRequest) {
|
|
29
39
|
const pkgConf = req.projConf.packages[path.basename(req.pkgPath)]!;
|
|
30
40
|
|
|
31
41
|
const buildRunnerType =
|
|
@@ -37,26 +47,17 @@ const worker = createSdWorker<TSdBuildRunnerWorkerType>({
|
|
|
37
47
|
? SdTsLibBuildRunner
|
|
38
48
|
: SdJsLibBuildRunner;
|
|
39
49
|
|
|
40
|
-
|
|
41
|
-
req.projConf,
|
|
50
|
+
buildRunner = new buildRunnerType(
|
|
42
51
|
req.pkgPath,
|
|
43
|
-
req.
|
|
52
|
+
req.projConf,
|
|
53
|
+
req.watch ?? false,
|
|
54
|
+
req.watch ? !pkgConf.forceProductionMode : false,
|
|
44
55
|
req.emitOnly,
|
|
45
56
|
req.noEmit,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
worker.send("complete", result);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
if (req.cmd === "build") {
|
|
55
|
-
const res = await builder.buildAsync();
|
|
56
|
-
return res.buildMessages;
|
|
57
|
-
} else {
|
|
58
|
-
await builder.watchAsync();
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
57
|
+
req.scopePathSet,
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
async rebuild(modifiedFileSet?: Set<TNormPath>) {
|
|
61
|
+
return await buildRunner.rebuildAsync(modifiedFileSet);
|
|
61
62
|
},
|
|
62
63
|
});
|
|
@@ -3,7 +3,7 @@ import { pathToFileURL } from "url";
|
|
|
3
3
|
import type { SdServiceServer } from "@simplysm/sd-service-server";
|
|
4
4
|
import { createSdWorker, SdLogger, SdLoggerSeverity } from "@simplysm/sd-core-node";
|
|
5
5
|
import { EventEmitter } from "events";
|
|
6
|
-
import {
|
|
6
|
+
import { IServerWorkerType } from "../types/worker/IServerWorkerType";
|
|
7
7
|
|
|
8
8
|
Error.stackTraceLimit = Infinity;
|
|
9
9
|
EventEmitter.defaultMaxListeners = 0;
|
|
@@ -22,10 +22,10 @@ if (process.env["SD_DEBUG"] != null) {
|
|
|
22
22
|
|
|
23
23
|
let server: SdServiceServer;
|
|
24
24
|
|
|
25
|
-
createSdWorker<
|
|
26
|
-
async listen(
|
|
27
|
-
if ("
|
|
28
|
-
const mainFilePath = path.resolve(
|
|
25
|
+
createSdWorker<IServerWorkerType>({
|
|
26
|
+
async listen(pkgPathOrPort: string | number) {
|
|
27
|
+
if (typeof pkgPathOrPort === "string") {
|
|
28
|
+
const mainFilePath = path.resolve(pkgPathOrPort, "dist/main.js");
|
|
29
29
|
const serverModule = await import(pathToFileURL(mainFilePath).href);
|
|
30
30
|
const currServer = serverModule.default as SdServiceServer | undefined;
|
|
31
31
|
if (currServer == null) {
|
|
@@ -38,14 +38,14 @@ createSdWorker<TServerWorkerType>({
|
|
|
38
38
|
server = new SdServiceServer({
|
|
39
39
|
rootPath: process.cwd(),
|
|
40
40
|
services: [],
|
|
41
|
-
port:
|
|
41
|
+
port: pkgPathOrPort,
|
|
42
42
|
});
|
|
43
43
|
await server.listenAsync();
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
return server.options.port;
|
|
47
47
|
},
|
|
48
|
-
setPathProxy(pathProxy: Record<string, string
|
|
48
|
+
setPathProxy(pathProxy: Record<string, string>) {
|
|
49
49
|
server.pathProxy = pathProxy;
|
|
50
50
|
},
|
|
51
51
|
broadcastReload(clientName: string | undefined, changedFileSet: Set<string>) {
|