@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,27 +1,23 @@
|
|
|
1
1
|
import { FsUtils, PathUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import { SdBuildRunnerBase } from "../commons/SdBuildRunnerBase";
|
|
4
|
+
import { SdNgBundler } from "./SdNgBundler";
|
|
5
|
+
import { SdCliCordova } from "../../entry/SdCliCordova";
|
|
6
|
+
import { ISdBuildResult } from "../../types/build/ISdBuildResult";
|
|
7
|
+
import { INpmConfig } from "../../types/common-config/INpmConfig";
|
|
8
|
+
import { SdCliNgRoutesFileGenerator } from "./SdCliNgRoutesFileGenerator";
|
|
9
|
+
import { SdCliElectron } from "../../entry/SdCliElectron";
|
|
10
|
+
|
|
11
|
+
export class SdClientBuildRunner extends SdBuildRunnerBase<"client"> {
|
|
11
12
|
protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdClientBuildRunner"]);
|
|
12
13
|
|
|
13
14
|
#ngBundlers?: SdNgBundler[];
|
|
14
15
|
#cordova?: SdCliCordova;
|
|
15
16
|
|
|
16
|
-
protected override async _runAsync(
|
|
17
|
-
dev: boolean,
|
|
18
|
-
emitOnly: boolean,
|
|
19
|
-
noEmit: boolean,
|
|
20
|
-
modifiedFileSet?: Set<TNormPath>,
|
|
21
|
-
): Promise<IBuildRunnerRunResult> {
|
|
17
|
+
protected override async _runAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
|
|
22
18
|
// 최초 한번
|
|
23
19
|
if (!modifiedFileSet) {
|
|
24
|
-
if (!
|
|
20
|
+
if (!this._noEmit) {
|
|
25
21
|
// config
|
|
26
22
|
this._debug("GEN .config...");
|
|
27
23
|
const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
|
|
@@ -57,17 +53,18 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
|
|
|
57
53
|
this.#ngBundlers = ngBundlerBuilderTypes.map(
|
|
58
54
|
(ngBundlerBuilderType) =>
|
|
59
55
|
new SdNgBundler({
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
watch: this._watch,
|
|
57
|
+
dev: this._dev,
|
|
58
|
+
emitOnly: this._emitOnly ?? false,
|
|
59
|
+
noEmit: this._noEmit ?? false,
|
|
63
60
|
builderType: ngBundlerBuilderType,
|
|
64
61
|
pkgPath: this._pkgPath,
|
|
65
62
|
outputPath:
|
|
66
63
|
ngBundlerBuilderType === "web"
|
|
67
64
|
? PathUtils.norm(this._pkgPath, "dist")
|
|
68
|
-
: ngBundlerBuilderType === "electron" && !
|
|
65
|
+
: ngBundlerBuilderType === "electron" && !this._dev
|
|
69
66
|
? PathUtils.norm(this._pkgPath, ".electron/src")
|
|
70
|
-
: ngBundlerBuilderType === "cordova" && !
|
|
67
|
+
: ngBundlerBuilderType === "cordova" && !this._dev
|
|
71
68
|
? PathUtils.norm(this._pkgPath, ".cordova/www")
|
|
72
69
|
: PathUtils.norm(this._pkgPath, "dist", ngBundlerBuilderType),
|
|
73
70
|
env: {
|
|
@@ -80,18 +77,18 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
|
|
|
80
77
|
: [],
|
|
81
78
|
cordovaConfig:
|
|
82
79
|
ngBundlerBuilderType === "cordova" ? this._pkgConf.builder!.cordova : undefined,
|
|
83
|
-
|
|
80
|
+
scopePathSet: this._scopePathSet,
|
|
84
81
|
}),
|
|
85
82
|
);
|
|
86
83
|
}
|
|
87
84
|
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
ngBundler.markForChanges(Array.from(modifiedFileSet));
|
|
92
|
-
}
|
|
85
|
+
if (modifiedFileSet) {
|
|
86
|
+
for (const ngBundler of this.#ngBundlers!) {
|
|
87
|
+
ngBundler.markForChanges(Array.from(modifiedFileSet));
|
|
93
88
|
}
|
|
89
|
+
}
|
|
94
90
|
|
|
91
|
+
if (this._noEmit) {
|
|
95
92
|
this._debug(`BUILD...`);
|
|
96
93
|
const buildResults = await Promise.all(
|
|
97
94
|
this.#ngBundlers!.map((builder) => builder.bundleAsync()),
|
|
@@ -101,23 +98,18 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
|
|
|
101
98
|
buildResults.mapMany((item) => Array.from(item.affectedFileSet)),
|
|
102
99
|
);
|
|
103
100
|
const emitFileSet = new Set(buildResults.mapMany((item) => Array.from(item.emitFileSet)));
|
|
104
|
-
const
|
|
101
|
+
const buildMessages = buildResults.mapMany((item) => item.buildMessages).distinct();
|
|
105
102
|
|
|
106
103
|
this._debug(`빌드 완료`);
|
|
107
104
|
|
|
108
105
|
return {
|
|
106
|
+
buildMessages,
|
|
107
|
+
|
|
109
108
|
watchFileSet,
|
|
110
109
|
affectedFileSet,
|
|
111
|
-
buildMessages: results,
|
|
112
110
|
emitFileSet,
|
|
113
111
|
};
|
|
114
112
|
} else {
|
|
115
|
-
if (modifiedFileSet) {
|
|
116
|
-
for (const ngBundler of this.#ngBundlers!) {
|
|
117
|
-
ngBundler.markForChanges(Array.from(modifiedFileSet));
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
113
|
this._debug(`BUILD...`);
|
|
122
114
|
const buildResults = await Promise.all(
|
|
123
115
|
this.#ngBundlers!.map((builder) => builder.bundleAsync()),
|
|
@@ -127,14 +119,14 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
|
|
|
127
119
|
buildResults.mapMany((item) => Array.from(item.affectedFileSet)),
|
|
128
120
|
);
|
|
129
121
|
const emitFileSet = new Set(buildResults.mapMany((item) => Array.from(item.emitFileSet)));
|
|
130
|
-
const
|
|
122
|
+
const buildMessages = buildResults.mapMany((item) => item.buildMessages).distinct();
|
|
131
123
|
|
|
132
|
-
if (!
|
|
124
|
+
if (!this._dev && this.#cordova) {
|
|
133
125
|
this._debug("CORDOVA BUILD...");
|
|
134
126
|
await this.#cordova.buildAsync(path.resolve(this._pkgPath, "dist"));
|
|
135
127
|
}
|
|
136
128
|
|
|
137
|
-
if (!
|
|
129
|
+
if (!this._dev && this._pkgConf.builder?.electron) {
|
|
138
130
|
this._debug("ELECTRON BUILD...");
|
|
139
131
|
await SdCliElectron.buildAsync({
|
|
140
132
|
pkgPath: this._pkgPath,
|
|
@@ -145,9 +137,10 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
|
|
|
145
137
|
this._debug(`빌드 완료`);
|
|
146
138
|
|
|
147
139
|
return {
|
|
140
|
+
buildMessages,
|
|
141
|
+
|
|
148
142
|
watchFileSet,
|
|
149
143
|
affectedFileSet,
|
|
150
|
-
buildMessages: results,
|
|
151
144
|
emitFileSet,
|
|
152
145
|
};
|
|
153
146
|
}
|
|
@@ -5,7 +5,7 @@ import { fileURLToPath } from "url";
|
|
|
5
5
|
import nodeStdLibBrowser from "node-stdlib-browser";
|
|
6
6
|
import nodeStdLibBrowserPlugin from "node-stdlib-browser/helpers/esbuild/plugin";
|
|
7
7
|
import browserslist from "browserslist";
|
|
8
|
-
import { SdNgBundlerContext } from "./
|
|
8
|
+
import { SdNgBundlerContext } from "./SdNgBundlerContext";
|
|
9
9
|
import { MemoryLoadResultCache } from "@angular/build/src/tools/esbuild/load-result-cache";
|
|
10
10
|
import {
|
|
11
11
|
convertOutputFile,
|
|
@@ -26,26 +26,20 @@ import {
|
|
|
26
26
|
import { Entrypoint } from "@angular/build/src/utils/index-file/augment-index-html";
|
|
27
27
|
import { CrossOrigin } from "@angular/build/src/builders/application/schema";
|
|
28
28
|
import { augmentAppWithServiceWorkerEsbuild } from "@angular/build/src/utils/service-worker";
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
} from "@angular/build/src/tools/esbuild/sourcemap-ignorelist-plugin";
|
|
32
|
-
import {
|
|
33
|
-
StylesheetPluginFactory
|
|
34
|
-
} from "@angular/build/src/tools/esbuild/stylesheets/stylesheet-plugin-factory";
|
|
29
|
+
import { createSourcemapIgnorelistPlugin } from "@angular/build/src/tools/esbuild/sourcemap-ignorelist-plugin";
|
|
30
|
+
import { StylesheetPluginFactory } from "@angular/build/src/tools/esbuild/stylesheets/stylesheet-plugin-factory";
|
|
35
31
|
import { SassStylesheetLanguage } from "@angular/build/src/tools/esbuild/stylesheets/sass-language";
|
|
36
32
|
import { CssStylesheetLanguage } from "@angular/build/src/tools/esbuild/stylesheets/css-language";
|
|
37
|
-
import {
|
|
38
|
-
createCssResourcePlugin
|
|
39
|
-
} from "@angular/build/src/tools/esbuild/stylesheets/css-resource-plugin";
|
|
33
|
+
import { createCssResourcePlugin } from "@angular/build/src/tools/esbuild/stylesheets/css-resource-plugin";
|
|
40
34
|
import { resolveAssets } from "@angular/build/src/utils/resolve-assets";
|
|
41
|
-
import { createSdNgPlugin } from "./
|
|
42
|
-
import { SdCliPerformanceTimer } from "../../utils/
|
|
43
|
-
import {
|
|
44
|
-
import { ISdClientBuilderCordovaConfig } from "../../types/config.types";
|
|
45
|
-
import { ISdCliNgPluginResultCache } from "../../types/build-plugin.types";
|
|
46
|
-
import { ISdBuildMessage } from "../../types/build.types";
|
|
35
|
+
import { createSdNgPlugin } from "./createSdNgPlugin";
|
|
36
|
+
import { SdCliPerformanceTimer } from "../../utils/SdCliPerformanceTimer";
|
|
37
|
+
import { ISdClientBuilderCordovaConfig } from "../../types/config/ISdProjectConfig";
|
|
47
38
|
import nodeModule from "module";
|
|
48
|
-
import { ScopePathSet } from "../commons/
|
|
39
|
+
import { ScopePathSet } from "../commons/ScopePathSet";
|
|
40
|
+
import { ISdCliNgPluginResultCache } from "../../types/plugin/ISdCliNgPluginResultCache";
|
|
41
|
+
import { INpmConfig } from "../../types/common-config/INpmConfig";
|
|
42
|
+
import { ISdBuildResult } from "../../types/build/ISdBuildResult";
|
|
49
43
|
|
|
50
44
|
export class SdNgBundler {
|
|
51
45
|
#logger = SdLogger.get(["simplysm", "sd-cli", "SdNgBundler"]);
|
|
@@ -72,6 +66,7 @@ export class SdNgBundler {
|
|
|
72
66
|
|
|
73
67
|
constructor(
|
|
74
68
|
private readonly _opt: {
|
|
69
|
+
watch: boolean;
|
|
75
70
|
dev: boolean;
|
|
76
71
|
emitOnly: boolean;
|
|
77
72
|
noEmit: boolean;
|
|
@@ -81,7 +76,7 @@ export class SdNgBundler {
|
|
|
81
76
|
env: Record<string, string> | undefined;
|
|
82
77
|
external: string[];
|
|
83
78
|
cordovaConfig: ISdClientBuilderCordovaConfig | undefined;
|
|
84
|
-
|
|
79
|
+
scopePathSet: ScopePathSet;
|
|
85
80
|
},
|
|
86
81
|
) {
|
|
87
82
|
this.#pkgNpmConf = FsUtils.readJson(path.resolve(this._opt.pkgPath, "package.json"));
|
|
@@ -107,12 +102,7 @@ export class SdNgBundler {
|
|
|
107
102
|
// this._sourceFileCache.invalidate(filePaths);
|
|
108
103
|
}
|
|
109
104
|
|
|
110
|
-
async bundleAsync(): Promise<{
|
|
111
|
-
watchFileSet: Set<TNormPath>;
|
|
112
|
-
affectedFileSet: Set<TNormPath>;
|
|
113
|
-
results: ISdBuildMessage[];
|
|
114
|
-
emitFileSet: Set<TNormPath>;
|
|
115
|
-
}> {
|
|
105
|
+
async bundleAsync(): Promise<ISdBuildResult> {
|
|
116
106
|
const perf = new SdCliPerformanceTimer("ng bundle");
|
|
117
107
|
|
|
118
108
|
this.#debug(`get contexts...`);
|
|
@@ -134,13 +124,13 @@ export class SdNgBundler {
|
|
|
134
124
|
});
|
|
135
125
|
|
|
136
126
|
//-- results
|
|
137
|
-
const
|
|
127
|
+
const buildMessages = bundlingResults.mapMany((bundlingResult) => bundlingResult.results);
|
|
138
128
|
|
|
139
129
|
if (this._opt.noEmit) {
|
|
140
130
|
return {
|
|
141
131
|
watchFileSet: this.#ngResultCache.watchFileSet!,
|
|
142
132
|
affectedFileSet: this.#ngResultCache.affectedFileSet!,
|
|
143
|
-
|
|
133
|
+
buildMessages,
|
|
144
134
|
emitFileSet: new Set<TNormPath>(),
|
|
145
135
|
};
|
|
146
136
|
} else {
|
|
@@ -173,7 +163,7 @@ export class SdNgBundler {
|
|
|
173
163
|
await perf.run("create index.html", async () => {
|
|
174
164
|
const genIndexHtmlResult = await this.#genIndexHtmlAsync(outputFiles, initialFiles);
|
|
175
165
|
for (const warning of genIndexHtmlResult.warnings) {
|
|
176
|
-
|
|
166
|
+
buildMessages.push({
|
|
177
167
|
filePath: undefined,
|
|
178
168
|
line: undefined,
|
|
179
169
|
char: undefined,
|
|
@@ -184,7 +174,7 @@ export class SdNgBundler {
|
|
|
184
174
|
});
|
|
185
175
|
}
|
|
186
176
|
for (const error of genIndexHtmlResult.errors) {
|
|
187
|
-
|
|
177
|
+
buildMessages.push({
|
|
188
178
|
filePath: undefined,
|
|
189
179
|
line: undefined,
|
|
190
180
|
char: undefined,
|
|
@@ -228,7 +218,7 @@ export class SdNgBundler {
|
|
|
228
218
|
);
|
|
229
219
|
assetFiles.push(...serviceWorkerResult.assetFiles);
|
|
230
220
|
} catch (err) {
|
|
231
|
-
|
|
221
|
+
buildMessages.push({
|
|
232
222
|
filePath: undefined,
|
|
233
223
|
line: undefined,
|
|
234
224
|
char: undefined,
|
|
@@ -280,7 +270,7 @@ export class SdNgBundler {
|
|
|
280
270
|
PathUtils.norm(this.#indexHtmlFilePath),
|
|
281
271
|
]),
|
|
282
272
|
affectedFileSet: this.#ngResultCache.affectedFileSet!,
|
|
283
|
-
|
|
273
|
+
buildMessages,
|
|
284
274
|
emitFileSet: emitFileSet,
|
|
285
275
|
};
|
|
286
276
|
}
|
|
@@ -530,12 +520,13 @@ export class SdNgBundler {
|
|
|
530
520
|
createSourcemapIgnorelistPlugin(),
|
|
531
521
|
createSdNgPlugin({
|
|
532
522
|
modifiedFileSet: this.#modifiedFileSet,
|
|
523
|
+
watch: this._opt.watch,
|
|
533
524
|
dev: this._opt.dev,
|
|
534
525
|
emitOnly: this._opt.emitOnly,
|
|
535
526
|
noEmit: this._opt.noEmit,
|
|
536
527
|
pkgPath: this._opt.pkgPath,
|
|
537
528
|
result: this.#ngResultCache,
|
|
538
|
-
|
|
529
|
+
scopePathSet: this._opt.scopePathSet,
|
|
539
530
|
}),
|
|
540
531
|
...(this._opt.builderType === "electron"
|
|
541
532
|
? []
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import esbuild from "esbuild";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { SdLogger } from "@simplysm/sd-core-node";
|
|
4
|
-
import { SdCliConvertMessageUtils } from "../../utils/
|
|
4
|
+
import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
|
|
5
5
|
|
|
6
6
|
// import { InitialFileRecord } from "@angular/build/src/tools/esbuild/bundler-context";
|
|
7
7
|
|
|
@@ -22,8 +22,7 @@ export class SdNgBundlerContext {
|
|
|
22
22
|
constructor(
|
|
23
23
|
private readonly _pkgPath: string,
|
|
24
24
|
private readonly _esbuildOptions: esbuild.BuildOptions,
|
|
25
|
-
) {
|
|
26
|
-
}
|
|
25
|
+
) {}
|
|
27
26
|
|
|
28
27
|
async bundleAsync() {
|
|
29
28
|
if (this.#context == null) {
|
|
@@ -36,12 +35,10 @@ export class SdNgBundlerContext {
|
|
|
36
35
|
this.#debug(`rebuild...`);
|
|
37
36
|
esbuildResult = await this.#context.rebuild();
|
|
38
37
|
this.#debug(`rebuild completed`);
|
|
39
|
-
}
|
|
40
|
-
catch (err) {
|
|
38
|
+
} catch (err) {
|
|
41
39
|
if ("warnings" in err || "errors" in err) {
|
|
42
40
|
esbuildResult = err;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
41
|
+
} else {
|
|
45
42
|
throw err;
|
|
46
43
|
}
|
|
47
44
|
}
|
|
@@ -120,8 +117,9 @@ export class SdNgBundlerContext {
|
|
|
120
117
|
|
|
121
118
|
#debug(...msg: any[]): void {
|
|
122
119
|
this.#logger.debug(
|
|
123
|
-
`[${path.basename(this._pkgPath)}] (${Object.keys(
|
|
124
|
-
.
|
|
120
|
+
`[${path.basename(this._pkgPath)}] (${Object.keys(
|
|
121
|
+
this._esbuildOptions.entryPoints as Record<string, any>,
|
|
122
|
+
).join(", ")})`,
|
|
125
123
|
...msg,
|
|
126
124
|
);
|
|
127
125
|
}
|
|
@@ -3,21 +3,22 @@ import path from "path";
|
|
|
3
3
|
import os from "os";
|
|
4
4
|
import { JavaScriptTransformer } from "@angular/build/src/tools/esbuild/javascript-transformer";
|
|
5
5
|
import { FsUtils, PathUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
|
|
6
|
-
import { SdCliPerformanceTimer } from "../../utils/
|
|
7
|
-
import { SdCliConvertMessageUtils } from "../../utils/
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
6
|
+
import { SdCliPerformanceTimer } from "../../utils/SdCliPerformanceTimer";
|
|
7
|
+
import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
|
|
8
|
+
import { SdTsCompiler } from "../../ts-compiler/SdTsCompiler";
|
|
9
|
+
import { ScopePathSet } from "../commons/ScopePathSet";
|
|
10
|
+
import { ISdCliNgPluginResultCache } from "../../types/plugin/ISdCliNgPluginResultCache";
|
|
11
|
+
import { ISdTsCompilerResult } from "../../types/build/ISdTsCompilerResult";
|
|
12
12
|
|
|
13
13
|
export function createSdNgPlugin(conf: {
|
|
14
14
|
pkgPath: TNormPath;
|
|
15
|
+
watch: boolean;
|
|
15
16
|
dev: boolean;
|
|
16
17
|
emitOnly: boolean;
|
|
17
18
|
noEmit: boolean;
|
|
18
19
|
modifiedFileSet: Set<TNormPath>;
|
|
19
20
|
result: ISdCliNgPluginResultCache;
|
|
20
|
-
|
|
21
|
+
scopePathSet: ScopePathSet;
|
|
21
22
|
}): esbuild.Plugin {
|
|
22
23
|
let perf: SdCliPerformanceTimer;
|
|
23
24
|
const logger = SdLogger.get(["simplysm", "sd-cli", "createSdNgPlugin"]);
|
|
@@ -32,11 +33,12 @@ export function createSdNgPlugin(conf: {
|
|
|
32
33
|
const tsCompiler = new SdTsCompiler({
|
|
33
34
|
pkgPath: conf.pkgPath,
|
|
34
35
|
additionalOptions: { declaration: false },
|
|
36
|
+
isWatchMode: conf.watch,
|
|
35
37
|
isDevMode: conf.dev,
|
|
36
38
|
isForBundle: true,
|
|
37
39
|
isEmitOnly: conf.emitOnly,
|
|
38
40
|
isNoEmit: conf.noEmit,
|
|
39
|
-
|
|
41
|
+
scopePathSet: conf.scopePathSet,
|
|
40
42
|
});
|
|
41
43
|
|
|
42
44
|
let tsCompileResult: ISdTsCompilerResult;
|
|
@@ -53,8 +55,6 @@ export function createSdNgPlugin(conf: {
|
|
|
53
55
|
Math.floor((os.cpus().length * 2) / 3),
|
|
54
56
|
);
|
|
55
57
|
|
|
56
|
-
// let cssStore = new Map<TNormPath, Buffer>();
|
|
57
|
-
|
|
58
58
|
//---------------------------
|
|
59
59
|
|
|
60
60
|
build.onStart(async () => {
|
|
@@ -67,8 +67,6 @@ export function createSdNgPlugin(conf: {
|
|
|
67
67
|
|
|
68
68
|
tsCompileResult = await tsCompiler.compileAsync(conf.modifiedFileSet);
|
|
69
69
|
|
|
70
|
-
// cssStore.clear();
|
|
71
|
-
|
|
72
70
|
conf.result.watchFileSet = tsCompileResult.watchFileSet;
|
|
73
71
|
conf.result.affectedFileSet = tsCompileResult.affectedFileSet;
|
|
74
72
|
|
|
@@ -76,6 +74,7 @@ export function createSdNgPlugin(conf: {
|
|
|
76
74
|
tsCompileResult.messages,
|
|
77
75
|
conf.pkgPath,
|
|
78
76
|
);
|
|
77
|
+
|
|
79
78
|
//-- return err/warn
|
|
80
79
|
return {
|
|
81
80
|
errors: [
|
|
@@ -97,83 +96,9 @@ export function createSdNgPlugin(conf: {
|
|
|
97
96
|
return res;
|
|
98
97
|
});
|
|
99
98
|
|
|
100
|
-
/*build.onResolve({ filter: /\.css$/ }, (args) => {
|
|
101
|
-
if (args.path.startsWith("sd-css-asset:")) return;
|
|
102
|
-
return {
|
|
103
|
-
path: path.resolve(args.resolveDir, args.path),
|
|
104
|
-
namespace: "sd-css",
|
|
105
|
-
};
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
build.onLoad({ filter: /\.css$/, namespace: "sd-css" }, async (args) => {
|
|
109
|
-
const code = /!* language=javascript *!/ `
|
|
110
|
-
import href from "sd-css-asset:${PathUtils.posix(args.path)}"
|
|
111
|
-
(function __sdEnsureStyle(href) {
|
|
112
|
-
let link = document.querySelector('link[data-sd-style="' + href + '"]');
|
|
113
|
-
if (link) return;
|
|
114
|
-
link = document.createElement('link');
|
|
115
|
-
link.rel = 'stylesheet';
|
|
116
|
-
link.setAttribute('data-sd-style', href);
|
|
117
|
-
link.href = href;
|
|
118
|
-
document.head.appendChild(link);
|
|
119
|
-
})(href);`;
|
|
120
|
-
|
|
121
|
-
if (FsUtils.exists(args.path)) {
|
|
122
|
-
const css = await FsUtils.readFileBufferAsync(args.path);
|
|
123
|
-
cssStore.set(PathUtils.norm(args.path), css);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return { contents: code, loader: "js", resolveDir: path.dirname(args.path) };
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
build.onResolve({ filter: /^sd-css-asset:/ }, (args) => {
|
|
130
|
-
const real = args.path.replace(/^sd-css-asset:/, "");
|
|
131
|
-
return { path: real, namespace: "sd-css-asset" };
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
build.onLoad({ filter: /\.css$/, namespace: "sd-css-asset" }, (args) => {
|
|
135
|
-
const cssContent =
|
|
136
|
-
cssStore.get(PathUtils.norm(args.path)) ??
|
|
137
|
-
cssStore.get(PathUtils.norm(args.path.replace(/[\\\/]src[\\\/]/, "\\dist\\")));
|
|
138
|
-
if (cssContent == null) {
|
|
139
|
-
return {
|
|
140
|
-
errors: [
|
|
141
|
-
{
|
|
142
|
-
location: null,
|
|
143
|
-
text: `Missing CSS for ${PathUtils.norm(args.path)}`,
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return {
|
|
150
|
-
contents: cssContent,
|
|
151
|
-
loader: "file",
|
|
152
|
-
resolveDir: path.dirname(args.path),
|
|
153
|
-
};
|
|
154
|
-
});*/
|
|
155
|
-
|
|
156
99
|
build.onLoad({ filter: /\.ts$/ }, async (args) => {
|
|
157
100
|
const emittedFiles = tsCompileResult.emittedFilesCacheMap.get(PathUtils.norm(args.path));
|
|
158
101
|
|
|
159
|
-
/*try {
|
|
160
|
-
const css = emittedFiles?.single((item) => Boolean(item.outAbsPath?.endsWith(".css")));
|
|
161
|
-
if (css) {
|
|
162
|
-
cssStore.set(PathUtils.norm(css.outAbsPath!), Buffer.from(css.text));
|
|
163
|
-
}
|
|
164
|
-
} catch (err) {
|
|
165
|
-
return {
|
|
166
|
-
errors: [
|
|
167
|
-
{
|
|
168
|
-
text:
|
|
169
|
-
(err?.message ?? String(err)) +
|
|
170
|
-
"\n" +
|
|
171
|
-
emittedFiles?.map((item) => "- " + item.outAbsPath).join("\n"),
|
|
172
|
-
},
|
|
173
|
-
],
|
|
174
|
-
};
|
|
175
|
-
}*/
|
|
176
|
-
|
|
177
102
|
const output = outputContentsCacheMap.get(PathUtils.norm(args.path));
|
|
178
103
|
if (output != null) {
|
|
179
104
|
return { contents: output, loader: "js" };
|
|
@@ -210,10 +135,6 @@ import href from "sd-css-asset:${PathUtils.posix(args.path)}"
|
|
|
210
135
|
|
|
211
136
|
try {
|
|
212
137
|
const newContents = await perf.run("esbuild transform:js:*.js", async () => {
|
|
213
|
-
/*return /\.min\.[cm]?js$/.test(args.path)
|
|
214
|
-
? await FsUtils.readFileBufferAsync(args.path)
|
|
215
|
-
: await javascriptTransformer.transformFile(args.path, false, sideEffects);*/
|
|
216
|
-
|
|
217
138
|
const contents = await FsUtils.readFileBufferAsync(args.path);
|
|
218
139
|
|
|
219
140
|
return await javascriptTransformer.transformData(
|
|
@@ -232,10 +153,6 @@ import href from "sd-css-asset:${PathUtils.posix(args.path)}"
|
|
|
232
153
|
};
|
|
233
154
|
} catch (err) {
|
|
234
155
|
return { errors: [{ text: err?.message ?? String(err) }] };
|
|
235
|
-
/*return {
|
|
236
|
-
contents: `console.error(${JSON.stringify(err.message)});`,
|
|
237
|
-
loader: "js",
|
|
238
|
-
};*/
|
|
239
156
|
}
|
|
240
157
|
});
|
|
241
158
|
|
|
@@ -3,8 +3,8 @@ import { PathUtils, TNormPath } from "@simplysm/sd-core-node";
|
|
|
3
3
|
export class ScopePathSet {
|
|
4
4
|
#data: Set<TNormPath>;
|
|
5
5
|
|
|
6
|
-
constructor(
|
|
7
|
-
this.#data = new Set(
|
|
6
|
+
constructor(arrOrSet?: TNormPath[] | Set<TNormPath>) {
|
|
7
|
+
this.#data = arrOrSet instanceof Set ? arrOrSet : new Set(arrOrSet);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
inScope(filePath: string) {
|
|
@@ -14,4 +14,4 @@ export class ScopePathSet {
|
|
|
14
14
|
toArray() {
|
|
15
15
|
return Array.from(this.#data);
|
|
16
16
|
}
|
|
17
|
-
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { FsUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { ISdProjectConfig, TSdPackageConfig } from "../../types/config/ISdProjectConfig";
|
|
4
|
+
import { ScopePathSet } from "./ScopePathSet";
|
|
5
|
+
import { ISdBuildResult } from "../../types/build/ISdBuildResult";
|
|
6
|
+
|
|
7
|
+
export abstract class SdBuildRunnerBase<T extends "server" | "library" | "client"> {
|
|
8
|
+
protected abstract _logger: SdLogger;
|
|
9
|
+
|
|
10
|
+
protected _pkgName: string;
|
|
11
|
+
protected _pkgConf: TSdPackageConfig<T>;
|
|
12
|
+
|
|
13
|
+
protected _scopePathSet: ScopePathSet;
|
|
14
|
+
|
|
15
|
+
constructor(
|
|
16
|
+
protected _pkgPath: TNormPath,
|
|
17
|
+
protected _projConf: ISdProjectConfig,
|
|
18
|
+
protected _watch: boolean,
|
|
19
|
+
protected _dev: boolean,
|
|
20
|
+
protected _emitOnly?: boolean,
|
|
21
|
+
protected _noEmit?: boolean,
|
|
22
|
+
scopePathSet?: Set<TNormPath>,
|
|
23
|
+
) {
|
|
24
|
+
this._pkgName = path.basename(_pkgPath);
|
|
25
|
+
this._pkgConf = _projConf.packages[this._pkgName] as TSdPackageConfig<T>;
|
|
26
|
+
|
|
27
|
+
this._scopePathSet = new ScopePathSet(scopePathSet);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async rebuildAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
|
|
31
|
+
if (!modifiedFileSet && !this._noEmit) {
|
|
32
|
+
const distPath = path.resolve(this._pkgPath, "dist");
|
|
33
|
+
if (FsUtils.exists(distPath)) {
|
|
34
|
+
this._debug("dist 초기화...");
|
|
35
|
+
FsUtils.remove(distPath);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return await this._runAsync(modifiedFileSet);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected abstract _runAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult>;
|
|
43
|
+
|
|
44
|
+
protected _debug(msg: string): void {
|
|
45
|
+
this._logger.debug(`[${path.basename(this._pkgPath)}] ${msg}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/pkg-builders/lib/{sd-cli-db-context.file-generator.ts → SdCliDbContextFileGenerator.ts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FsUtils, HashUtils, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { StringUtils } from "@simplysm/sd-core-common";
|
|
4
|
-
import { INpmConfig } from "../../types/common-
|
|
4
|
+
import { INpmConfig } from "../../types/common-config/INpmConfig";
|
|
5
5
|
|
|
6
6
|
export class SdCliDbContextFileGenerator {
|
|
7
7
|
cachedHash?: string;
|
|
@@ -1,29 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FsUtils,
|
|
3
|
-
ISdFsWatcherChangeInfo,
|
|
4
|
-
PathUtils,
|
|
5
|
-
SdLogger,
|
|
6
|
-
TNormPath,
|
|
7
|
-
} from "@simplysm/sd-core-node";
|
|
1
|
+
import { FsUtils, PathUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
|
|
8
2
|
import path from "path";
|
|
9
|
-
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
10
|
-
// import { TSdLintWorkerType } from "../../types/workers.type";
|
|
11
3
|
import { ESLint } from "eslint";
|
|
12
|
-
import {
|
|
4
|
+
import { SdBuildRunnerBase } from "../commons/SdBuildRunnerBase";
|
|
5
|
+
import { ISdBuildResult } from "../../types/build/ISdBuildResult";
|
|
6
|
+
import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
|
|
13
7
|
|
|
14
|
-
export class SdJsLibBuildRunner extends
|
|
8
|
+
export class SdJsLibBuildRunner extends SdBuildRunnerBase<"library"> {
|
|
15
9
|
protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdJsLibBuildRunner"]);
|
|
16
10
|
|
|
17
|
-
protected override async _runAsync(
|
|
18
|
-
|
|
19
|
-
emitOnly: boolean,
|
|
20
|
-
noEmit: boolean,
|
|
21
|
-
modifiedFileSet?: Set<TNormPath>,
|
|
22
|
-
): Promise<IBuildRunnerRunResult> {
|
|
23
|
-
if (emitOnly) {
|
|
11
|
+
protected override async _runAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
|
|
12
|
+
if (this._emitOnly) {
|
|
24
13
|
return {
|
|
25
|
-
affectedFileSet: new Set(),
|
|
26
14
|
buildMessages: [],
|
|
15
|
+
|
|
16
|
+
watchFileSet: new Set(),
|
|
17
|
+
affectedFileSet: new Set(),
|
|
27
18
|
emitFileSet: new Set(),
|
|
28
19
|
};
|
|
29
20
|
}
|
|
@@ -44,24 +35,14 @@ export class SdJsLibBuildRunner extends BuildRunnerBase<"library"> {
|
|
|
44
35
|
this._debug(`LINT 완료`);
|
|
45
36
|
|
|
46
37
|
return {
|
|
47
|
-
affectedFileSet: filePathSet,
|
|
48
38
|
buildMessages: messages,
|
|
39
|
+
|
|
40
|
+
watchFileSet: filePathSet,
|
|
41
|
+
affectedFileSet: filePathSet,
|
|
49
42
|
emitFileSet: new Set(),
|
|
50
43
|
};
|
|
51
44
|
}
|
|
52
45
|
|
|
53
|
-
protected override _getModifiedFileSet(changeInfos: ISdFsWatcherChangeInfo[]) {
|
|
54
|
-
return new Set(
|
|
55
|
-
changeInfos
|
|
56
|
-
.filter(
|
|
57
|
-
(item) =>
|
|
58
|
-
FsUtils.exists(item.path) &&
|
|
59
|
-
PathUtils.isChildPath(item.path, path.resolve(this._pkgPath, "src")),
|
|
60
|
-
)
|
|
61
|
-
.map((item) => item.path),
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
46
|
async #lintAsync(fileSet: Set<string>) {
|
|
66
47
|
const lintFilePaths = Array.from(fileSet)
|
|
67
48
|
.filter((item) => PathUtils.isChildPath(item, path.resolve(this._pkgPath, "src")))
|