@simplysm/sd-cli 14.0.41 → 14.0.43
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/angular/angular-compiler.d.ts +0 -35
- package/dist/angular/angular-compiler.d.ts.map +1 -1
- package/dist/angular/angular-compiler.js +0 -374
- package/dist/angular/angular-compiler.js.map +1 -1
- package/dist/angular/hmr-candidates.d.ts +13 -0
- package/dist/angular/hmr-candidates.d.ts.map +1 -0
- package/dist/angular/hmr-candidates.js +230 -0
- package/dist/angular/hmr-candidates.js.map +1 -0
- package/dist/angular/ngtsc-build-core.d.ts +29 -34
- package/dist/angular/ngtsc-build-core.d.ts.map +1 -1
- package/dist/angular/ngtsc-build-core.js +90 -51
- package/dist/angular/ngtsc-build-core.js.map +1 -1
- package/dist/angular/vite-angular-plugin.d.ts +1 -1
- package/dist/angular/vite-angular-plugin.d.ts.map +1 -1
- package/dist/angular/vite-angular-plugin.js +63 -56
- package/dist/angular/vite-angular-plugin.js.map +1 -1
- package/dist/angular/web-worker-transformer.d.ts +9 -0
- package/dist/angular/web-worker-transformer.d.ts.map +1 -0
- package/dist/angular/web-worker-transformer.js +73 -0
- package/dist/angular/web-worker-transformer.js.map +1 -0
- package/dist/capacitor/capacitor.d.ts.map +1 -1
- package/dist/capacitor/capacitor.js +6 -4
- package/dist/capacitor/capacitor.js.map +1 -1
- package/dist/commands/check.d.ts +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +15 -65
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/publish/deployment-phase.d.ts.map +1 -1
- package/dist/commands/publish/deployment-phase.js +13 -5
- package/dist/commands/publish/deployment-phase.js.map +1 -1
- package/dist/commands/publish/npm-publisher.js +1 -1
- package/dist/commands/publish/npm-publisher.js.map +1 -1
- package/dist/commands/publish/publish-command.js +1 -1
- package/dist/commands/publish/publish-command.js.map +1 -1
- package/dist/commands/publish/version-upgrade.js +1 -1
- package/dist/commands/publish/version-upgrade.js.map +1 -1
- package/dist/commands/replace-deps.d.ts.map +1 -1
- package/dist/commands/replace-deps.js +2 -1
- package/dist/commands/replace-deps.js.map +1 -1
- package/dist/deps/replace-deps/collect-deps.d.ts.map +1 -1
- package/dist/deps/replace-deps/collect-deps.js +5 -2
- package/dist/deps/replace-deps/collect-deps.js.map +1 -1
- package/dist/deps/replace-deps/replace-deps.d.ts +21 -3
- package/dist/deps/replace-deps/replace-deps.d.ts.map +1 -1
- package/dist/deps/replace-deps/replace-deps.js +107 -62
- package/dist/deps/replace-deps/replace-deps.js.map +1 -1
- package/dist/electron/electron.js +7 -7
- package/dist/electron/electron.js.map +1 -1
- package/dist/engines/BaseEngine.d.ts.map +1 -1
- package/dist/engines/BaseEngine.js +2 -5
- package/dist/engines/BaseEngine.js.map +1 -1
- package/dist/engines/EsbuildClientEngine.d.ts.map +1 -1
- package/dist/engines/EsbuildClientEngine.js +16 -9
- package/dist/engines/EsbuildClientEngine.js.map +1 -1
- package/dist/engines/NgtscEngine.d.ts +4 -4
- package/dist/engines/NgtscEngine.d.ts.map +1 -1
- package/dist/engines/NgtscEngine.js +5 -5
- package/dist/engines/NgtscEngine.js.map +1 -1
- package/dist/engines/TscEngine.d.ts.map +1 -1
- package/dist/engines/TscEngine.js +0 -2
- package/dist/engines/TscEngine.js.map +1 -1
- package/dist/engines/types.d.ts +2 -0
- package/dist/engines/types.d.ts.map +1 -1
- package/dist/esbuild/esbuild-angular-compiler-plugin.d.ts +36 -0
- package/dist/esbuild/esbuild-angular-compiler-plugin.d.ts.map +1 -0
- package/dist/esbuild/esbuild-angular-compiler-plugin.js +464 -0
- package/dist/esbuild/esbuild-angular-compiler-plugin.js.map +1 -0
- package/dist/esbuild/esbuild-client-config.d.ts +8 -2
- package/dist/esbuild/esbuild-client-config.d.ts.map +1 -1
- package/dist/esbuild/esbuild-client-config.js +48 -33
- package/dist/esbuild/esbuild-client-config.js.map +1 -1
- package/dist/esbuild/esbuild-tsc-plugin.d.ts +4 -1
- package/dist/esbuild/esbuild-tsc-plugin.d.ts.map +1 -1
- package/dist/esbuild/esbuild-tsc-plugin.js +27 -23
- package/dist/esbuild/esbuild-tsc-plugin.js.map +1 -1
- package/dist/esbuild/file-reference-tracker.d.ts +24 -0
- package/dist/esbuild/file-reference-tracker.d.ts.map +1 -0
- package/dist/esbuild/file-reference-tracker.js +57 -0
- package/dist/esbuild/file-reference-tracker.js.map +1 -0
- package/dist/esbuild/lmdb-cache-store.d.ts +18 -0
- package/dist/esbuild/lmdb-cache-store.d.ts.map +1 -0
- package/dist/esbuild/lmdb-cache-store.js +41 -0
- package/dist/esbuild/lmdb-cache-store.js.map +1 -0
- package/dist/esbuild/load-result-cache.d.ts +17 -0
- package/dist/esbuild/load-result-cache.d.ts.map +1 -0
- package/dist/esbuild/load-result-cache.js +61 -0
- package/dist/esbuild/load-result-cache.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lint/lint-core.js +7 -7
- package/dist/lint/lint-core.js.map +1 -1
- package/dist/orchestrators/BaseOrchestrator.js +2 -2
- package/dist/orchestrators/BaseOrchestrator.js.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.js +5 -19
- package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
- package/dist/orchestrators/DevOrchestrator.js +5 -5
- package/dist/orchestrators/DevOrchestrator.js.map +1 -1
- package/dist/orchestrators/WatchOrchestrator.js +6 -6
- package/dist/orchestrators/WatchOrchestrator.js.map +1 -1
- package/dist/runtime/ResultCollector.d.ts +1 -0
- package/dist/runtime/ResultCollector.d.ts.map +1 -1
- package/dist/runtime/ResultCollector.js.map +1 -1
- package/dist/runtime/engine-watch-events.d.ts.map +1 -1
- package/dist/runtime/engine-watch-events.js +3 -0
- package/dist/runtime/engine-watch-events.js.map +1 -1
- package/dist/runtime/rebuild-manager.js +1 -1
- package/dist/runtime/rebuild-manager.js.map +1 -1
- package/dist/runtime/worker-utils.js +1 -1
- package/dist/runtime/worker-utils.js.map +1 -1
- package/dist/sd-cli-entry.d.ts.map +1 -1
- package/dist/sd-cli-entry.js +4 -3
- package/dist/sd-cli-entry.js.map +1 -1
- package/dist/sd-cli.js +3 -3
- package/dist/sd-cli.js.map +1 -1
- package/dist/ts-compiler/SdTsCompiler.d.ts +39 -0
- package/dist/ts-compiler/SdTsCompiler.d.ts.map +1 -0
- package/dist/ts-compiler/SdTsCompiler.js +593 -0
- package/dist/ts-compiler/SdTsCompiler.js.map +1 -0
- package/dist/ts-compiler/sd-ts-compiler-options.d.ts +40 -0
- package/dist/ts-compiler/sd-ts-compiler-options.d.ts.map +1 -0
- package/dist/ts-compiler/sd-ts-compiler-options.js +2 -0
- package/dist/ts-compiler/sd-ts-compiler-options.js.map +1 -0
- package/dist/ts-compiler/sd-ts-compiler-result.d.ts +34 -0
- package/dist/ts-compiler/sd-ts-compiler-result.d.ts.map +1 -0
- package/dist/ts-compiler/sd-ts-compiler-result.js +2 -0
- package/dist/ts-compiler/sd-ts-compiler-result.js.map +1 -0
- package/dist/utils/copy-public.d.ts +6 -4
- package/dist/utils/copy-public.d.ts.map +1 -1
- package/dist/utils/copy-public.js +9 -7
- package/dist/utils/copy-public.js.map +1 -1
- package/dist/utils/diagnostic-utils.d.ts +2 -3
- package/dist/utils/diagnostic-utils.d.ts.map +1 -1
- package/dist/utils/diagnostic-utils.js +8 -9
- package/dist/utils/diagnostic-utils.js.map +1 -1
- package/dist/utils/output-utils.d.ts +8 -2
- package/dist/utils/output-utils.d.ts.map +1 -1
- package/dist/utils/output-utils.js +32 -8
- package/dist/utils/output-utils.js.map +1 -1
- package/dist/workers/client.worker.d.ts +1 -1
- package/dist/workers/client.worker.d.ts.map +1 -1
- package/dist/workers/client.worker.js +136 -110
- package/dist/workers/client.worker.js.map +1 -1
- package/dist/workers/library-build.worker.d.ts +0 -2
- package/dist/workers/library-build.worker.d.ts.map +1 -1
- package/dist/workers/library-build.worker.js +147 -70
- package/dist/workers/library-build.worker.js.map +1 -1
- package/dist/workers/server-build.worker.d.ts.map +1 -1
- package/dist/workers/server-build.worker.js +30 -57
- package/dist/workers/server-build.worker.js.map +1 -1
- package/dist/workers/server-esbuild-context.d.ts +7 -0
- package/dist/workers/server-esbuild-context.d.ts.map +1 -1
- package/dist/workers/server-esbuild-context.js +11 -2
- package/dist/workers/server-esbuild-context.js.map +1 -1
- package/package.json +7 -6
- package/src/angular/angular-compiler.ts +0 -502
- package/src/angular/hmr-candidates.ts +295 -0
- package/src/angular/ngtsc-build-core.ts +125 -92
- package/src/angular/vite-angular-plugin.ts +71 -65
- package/src/angular/web-worker-transformer.ts +117 -0
- package/src/capacitor/capacitor.ts +6 -4
- package/src/commands/check.ts +17 -76
- package/src/commands/publish/deployment-phase.ts +11 -7
- package/src/commands/publish/npm-publisher.ts +1 -1
- package/src/commands/publish/publish-command.ts +1 -1
- package/src/commands/publish/version-upgrade.ts +1 -1
- package/src/commands/replace-deps.ts +3 -1
- package/src/deps/replace-deps/collect-deps.ts +4 -2
- package/src/deps/replace-deps/replace-deps.ts +114 -66
- package/src/electron/electron.ts +7 -7
- package/src/engines/BaseEngine.ts +2 -6
- package/src/engines/EsbuildClientEngine.ts +16 -10
- package/src/engines/NgtscEngine.ts +7 -7
- package/src/engines/TscEngine.ts +0 -2
- package/src/engines/types.ts +2 -0
- package/src/esbuild/esbuild-angular-compiler-plugin.ts +647 -0
- package/src/esbuild/esbuild-client-config.ts +57 -41
- package/src/esbuild/esbuild-tsc-plugin.ts +33 -23
- package/src/esbuild/file-reference-tracker.ts +61 -0
- package/src/esbuild/lmdb-cache-store.ts +46 -0
- package/src/esbuild/load-result-cache.ts +85 -0
- package/src/index.ts +5 -0
- package/src/lint/lint-core.ts +7 -7
- package/src/orchestrators/BaseOrchestrator.ts +2 -2
- package/src/orchestrators/BuildOrchestrator.ts +5 -24
- package/src/orchestrators/DevOrchestrator.ts +5 -5
- package/src/orchestrators/WatchOrchestrator.ts +6 -6
- package/src/runtime/ResultCollector.ts +1 -0
- package/src/runtime/engine-watch-events.ts +3 -0
- package/src/runtime/rebuild-manager.ts +1 -1
- package/src/runtime/worker-utils.ts +1 -1
- package/src/sd-cli-entry.ts +5 -3
- package/src/sd-cli.ts +4 -4
- package/src/ts-compiler/SdTsCompiler.ts +815 -0
- package/src/ts-compiler/sd-ts-compiler-options.ts +46 -0
- package/src/ts-compiler/sd-ts-compiler-result.ts +34 -0
- package/src/utils/copy-public.ts +9 -6
- package/src/utils/diagnostic-utils.ts +8 -9
- package/src/utils/output-utils.ts +38 -8
- package/src/workers/client.worker.ts +160 -126
- package/src/workers/library-build.worker.ts +187 -75
- package/src/workers/server-build.worker.ts +31 -61
- package/src/workers/server-esbuild-context.ts +14 -2
- package/tests/angular/fixtures/packages/basic-app/dist/styles.css +3 -0
- package/tests/angular/fixtures/packages/basic-app/scss/styles.scss +5 -0
- package/tests/angular/vite-angular-plugin-sdtscompiler.verify.md +13 -0
- package/tests/angular/web-worker-transformer.spec.ts +154 -0
- package/tests/capacitor/capacitor-build.spec.ts +1 -1
- package/tests/capacitor/capacitor-icon.spec.ts +1 -1
- package/tests/capacitor/capacitor-init.spec.ts +1 -1
- package/tests/commands/check.spec.ts +90 -104
- package/tests/commands/publish.spec.ts +12 -4
- package/tests/commands/slice3-severity-cleanup.verify.md +12 -0
- package/tests/deps/replace-deps/collect-deps.acc.spec.ts +62 -0
- package/tests/deps/replace-deps/collect-deps.spec.ts +49 -0
- package/tests/deps/replace-deps/replace-deps-filter.spec.ts +103 -0
- package/tests/deps/replace-deps/replace-deps-setup.acc.spec.ts +156 -0
- package/tests/electron/electron.spec.ts +4 -1
- package/tests/engines/engine-adapter-isolation.spec.ts +5 -6
- package/tests/engines/engine-duplicate-output-removal.verify.md +10 -0
- package/tests/engines/esbuild-client-engine.acc.spec.ts +79 -0
- package/tests/engines/esbuild-client-engine.spec.ts +73 -3
- package/tests/esbuild/esbuild-angular-compiler-plugin-hmr.verify.md +23 -0
- package/tests/esbuild/esbuild-angular-compiler-plugin-onload.verify.md +21 -0
- package/tests/esbuild/esbuild-angular-compiler-plugin-onstart-extraction.verify.md +16 -0
- package/tests/esbuild/esbuild-angular-compiler-plugin-sdtscompiler.verify.md +15 -0
- package/tests/esbuild/esbuild-angular-compiler-plugin-stylesheet.verify.md +31 -0
- package/tests/esbuild/esbuild-angular-compiler-plugin-worker.verify.md +31 -0
- package/tests/esbuild/esbuild-angular-compiler-plugin.spec.ts +397 -0
- package/tests/esbuild/esbuild-angular-compiler-plugin.verify.md +21 -0
- package/tests/esbuild/esbuild-tsc-plugin-imports.verify.md +13 -0
- package/tests/esbuild/esbuild-tsc-plugin.acc.spec.ts +56 -111
- package/tests/esbuild/esbuild-tsc-plugin.spec.ts +116 -52
- package/tests/esbuild/file-reference-tracker.spec.ts +99 -0
- package/tests/esbuild/lmdb-cache-store.spec.ts +58 -0
- package/tests/esbuild/load-result-cache.acc.spec.ts +55 -0
- package/tests/esbuild/load-result-cache.spec.ts +133 -0
- package/tests/orchestrators/build-orchestrator.spec.ts +4 -3
- package/tests/orchestrators/dev-orchestrator.spec.ts +5 -5
- package/tests/orchestrators/slice1-stdout-to-consola.verify.md +10 -0
- package/tests/orchestrators/typecheck-orchestrator.spec.ts +1 -1
- package/tests/orchestrators/watch-orchestrator.spec.ts +7 -7
- package/tests/runtime/result-collector.spec.ts +64 -0
- package/tests/sd-cli-entry.spec.ts +3 -4
- package/tests/sd-cli-log-tag.verify.md +11 -0
- package/tests/ts-compiler/SdTsCompiler-affected-files.verify.md +8 -0
- package/tests/ts-compiler/SdTsCompiler-diagnostics.verify.md +12 -0
- package/tests/ts-compiler/SdTsCompiler-emit.verify.md +9 -0
- package/tests/ts-compiler/SdTsCompiler.acc.spec.ts +603 -0
- package/tests/ts-compiler/SdTsCompiler.spec.ts +265 -0
- package/tests/ts-compiler/SdTsCompiler.verify.md +41 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck-browser.tsbuildinfo +1 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck-node.tsbuildinfo +1 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck.tsbuildinfo +1 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/dist/index.d.ts +2 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/dist/index.d.ts.map +1 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/dist/index.js +4 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/dist/index.js.map +1 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/dist/util.d.ts +2 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/dist/util.d.ts.map +1 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/dist/util.js +4 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/dist/util.js.map +1 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/src/index.ts +3 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/src/util.ts +3 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/tests/sample.test-file.ts +3 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/tsconfig.json +12 -0
- package/tests/ts-compiler/scss-lint-integration.verify.md +14 -0
- package/tests/utils/angular-build.spec.ts +1 -1
- package/tests/utils/copy-public-outdir.verify.md +8 -0
- package/tests/utils/copy-public.acc.spec.ts +52 -0
- package/tests/utils/copy-public.spec.ts +56 -0
- package/tests/utils/diagnostic-utils.spec.ts +24 -15
- package/tests/utils/engine-watch-events.acc.spec.ts +59 -0
- package/tests/utils/engine-watch-events.spec.ts +58 -0
- package/tests/utils/esbuild-client-config-integration.verify.md +9 -0
- package/tests/utils/esbuild-client-config.acc.spec.ts +45 -61
- package/tests/utils/esbuild-client-config.spec.ts +70 -52
- package/tests/utils/ngtsc-build-core-write-emit.spec.ts +12 -12
- package/tests/utils/ngtsc-build-core.spec.ts +1 -44
- package/tests/utils/output-utils.spec.ts +133 -13
- package/tests/utils/replace-deps-watch.acc.spec.ts +7 -1
- package/tests/utils/replace-deps-watch.spec.ts +57 -1
- package/tests/utils/worker-utils.spec.ts +8 -2
- package/tests/workers/client-worker-initial-build-error.verify.md +2 -3
- package/tests/workers/client-worker-initial-build-warnings.verify.md +7 -0
- package/tests/workers/client-worker-refactor.verify.md +22 -0
- package/tests/workers/client-worker-ts-cache-invalidation.verify.md +12 -0
- package/tests/workers/client-worker.acc.spec.ts +6 -3
- package/tests/workers/library-build-lint.spec.ts +40 -45
- package/tests/workers/library-build-worker.spec.ts +294 -40
- package/tests/workers/server-build-lint.spec.ts +59 -45
- package/tests/workers/server-build-worker.spec.ts +63 -24
- package/tests/workers/server-esbuild-context.acc.spec.ts +2 -0
- package/tests/workers/server-esbuild-context.spec.ts +2 -0
- package/tests/workers/server-runtime-worker.spec.ts +1 -1
- package/tests/workers/shared-worker-lifecycle.acc.spec.ts +1 -1
- package/dist/angular/angular-build-pipeline.d.ts +0 -97
- package/dist/angular/angular-build-pipeline.d.ts.map +0 -1
- package/dist/angular/angular-build-pipeline.js +0 -285
- package/dist/angular/angular-build-pipeline.js.map +0 -1
- package/dist/utils/tsc-build.d.ts +0 -51
- package/dist/utils/tsc-build.d.ts.map +0 -1
- package/dist/utils/tsc-build.js +0 -156
- package/dist/utils/tsc-build.js.map +0 -1
- package/dist/workers/ngtsc-build.worker.d.ts +0 -23
- package/dist/workers/ngtsc-build.worker.d.ts.map +0 -1
- package/dist/workers/ngtsc-build.worker.js +0 -267
- package/dist/workers/ngtsc-build.worker.js.map +0 -1
- package/src/angular/angular-build-pipeline.ts +0 -406
- package/src/utils/tsc-build.ts +0 -226
- package/src/workers/ngtsc-build.worker.ts +0 -351
- package/tests/angular/angular-build-pipeline.spec.ts +0 -247
- package/tests/angular/angular-compiler-aot.acc.spec.ts +0 -68
- package/tests/angular/angular-compiler-aot.spec.ts +0 -80
- package/tests/utils/angular-compiler-emit.spec.ts +0 -666
- package/tests/utils/angular-compiler.spec.ts +0 -707
- package/tests/utils/tsc-build.spec.ts +0 -527
- package/tests/workers/ngtsc-build-lint.spec.ts +0 -141
- package/tests/workers/ngtsc-build-worker.spec.ts +0 -199
|
@@ -4,12 +4,13 @@ import { createRequire } from "module";
|
|
|
4
4
|
import esbuild from "esbuild";
|
|
5
5
|
import browserslistToEsbuild from "browserslist-to-esbuild";
|
|
6
6
|
import type { AcceptedPlugin } from "postcss";
|
|
7
|
+
import { AngularSourceFileCache } from "../angular/angular-compiler.js";
|
|
8
|
+
import { createClientTransformStylesheet } from "../angular/client-transform-stylesheet.js";
|
|
7
9
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from "@angular/build/private";
|
|
10
|
+
createAngularCompilerPlugin,
|
|
11
|
+
type AngularCompilerPluginOptions,
|
|
12
|
+
} from "./esbuild-angular-compiler-plugin.js";
|
|
13
|
+
import { MemoryLoadResultCache } from "./load-result-cache.js";
|
|
13
14
|
import { createScssPlugin } from "./esbuild-scss-plugin";
|
|
14
15
|
import { createPostcssPlugin } from "./esbuild-postcss-plugin";
|
|
15
16
|
|
|
@@ -42,9 +43,21 @@ export interface CreateClientEsbuildOptions {
|
|
|
42
43
|
legacyModule?: boolean;
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
export class ClientSourceFileCache extends AngularSourceFileCache {
|
|
47
|
+
readonly typeScriptFileCache = new Map<string, string | Uint8Array>();
|
|
48
|
+
readonly loadResultCache = new MemoryLoadResultCache();
|
|
49
|
+
|
|
50
|
+
override invalidate(files: Iterable<string>): void {
|
|
51
|
+
for (const file of files) {
|
|
52
|
+
this.loadResultCache.invalidate(file);
|
|
53
|
+
}
|
|
54
|
+
super.invalidate(files);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
45
58
|
export interface ClientEsbuildResult {
|
|
46
59
|
context: esbuild.BuildContext;
|
|
47
|
-
sourceFileCache:
|
|
60
|
+
sourceFileCache: ClientSourceFileCache;
|
|
48
61
|
}
|
|
49
62
|
|
|
50
63
|
export async function createClientEsbuildContext(
|
|
@@ -61,53 +74,56 @@ export async function createClientEsbuildContext(
|
|
|
61
74
|
esbuildTarget = browserslistToEsbuild(queries);
|
|
62
75
|
}
|
|
63
76
|
|
|
64
|
-
//
|
|
77
|
+
// ClientSourceFileCache 생성
|
|
78
|
+
const sourceFileCache = new ClientSourceFileCache();
|
|
79
|
+
|
|
80
|
+
// SCSS 스타일시트 변환용 공유 상태
|
|
81
|
+
const stylesheetDependencies = new Map<string, Set<string>>();
|
|
82
|
+
const stylesheetErrors: string[] = [];
|
|
83
|
+
|
|
84
|
+
// PostCSS 플러그인 로딩 (튜플 → 인스턴스) — transformStylesheet와 createPostcssPlugin 양쪽에 사용
|
|
85
|
+
let loadedPostcssPlugins: AcceptedPlugin[] | undefined;
|
|
86
|
+
if (options.postcssPlugins != null && options.postcssPlugins.length > 0) {
|
|
87
|
+
const req = createRequire(path.join(options.pkgDir, "package.json"));
|
|
88
|
+
loadedPostcssPlugins = options.postcssPlugins.map(([name, pluginOpts]) => {
|
|
89
|
+
const pluginFn = req(name);
|
|
90
|
+
const fn = pluginFn.default ?? pluginFn;
|
|
91
|
+
return pluginOpts != null ? fn(pluginOpts) : fn;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// transformStylesheet 콜백 생성
|
|
65
96
|
const cachePath = path.join(options.pkgDir, ".angular", "cache");
|
|
66
|
-
const
|
|
97
|
+
const transformStylesheet = createClientTransformStylesheet({
|
|
98
|
+
loadPaths: [
|
|
99
|
+
path.join(options.pkgDir, "node_modules"),
|
|
100
|
+
path.join(options.cwd, "node_modules"),
|
|
101
|
+
],
|
|
102
|
+
postcssPlugins: loadedPostcssPlugins,
|
|
103
|
+
scssErrors: stylesheetErrors,
|
|
104
|
+
scssDependencies: stylesheetDependencies,
|
|
105
|
+
cacheDir: path.join(cachePath, "scss"),
|
|
106
|
+
});
|
|
67
107
|
|
|
68
|
-
//
|
|
69
|
-
const pluginOptions:
|
|
108
|
+
// AngularCompilerPluginOptions
|
|
109
|
+
const pluginOptions: AngularCompilerPluginOptions = {
|
|
70
110
|
tsconfig: options.tsconfig ?? path.join(options.pkgDir, "tsconfig.json"),
|
|
71
111
|
sourcemap: isDev,
|
|
72
112
|
advancedOptimizations: !isDev,
|
|
73
113
|
thirdPartySourcemaps: isDev,
|
|
74
114
|
incremental: isDev,
|
|
75
115
|
sourceFileCache,
|
|
116
|
+
typeScriptFileCache: sourceFileCache.typeScriptFileCache,
|
|
76
117
|
loadResultCache: sourceFileCache.loadResultCache,
|
|
77
118
|
templateUpdates: options.templateUpdates,
|
|
78
119
|
includeTestMetadata: isDev,
|
|
120
|
+
persistentCachePath: cachePath,
|
|
121
|
+
transformStylesheet,
|
|
122
|
+
stylesheetDependencies,
|
|
123
|
+
stylesheetErrors,
|
|
79
124
|
};
|
|
80
125
|
|
|
81
|
-
|
|
82
|
-
const styleOptions: BundleStylesheetOptions & { inlineStyleLanguage: string } = {
|
|
83
|
-
workspaceRoot: options.cwd,
|
|
84
|
-
optimization: !isDev,
|
|
85
|
-
inlineFonts: false,
|
|
86
|
-
sourcemap: isDev ? "linked" : false,
|
|
87
|
-
outputNames: { bundles: "[name]", media: "media/[name]" },
|
|
88
|
-
includePaths: [],
|
|
89
|
-
target: esbuildTarget,
|
|
90
|
-
cacheOptions: {
|
|
91
|
-
enabled: true,
|
|
92
|
-
path: cachePath,
|
|
93
|
-
basePath: cachePath,
|
|
94
|
-
},
|
|
95
|
-
postcssConfiguration: undefined,
|
|
96
|
-
inlineStyleLanguage: "scss",
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const angularPlugin = createCompilerPlugin(pluginOptions, styleOptions);
|
|
100
|
-
|
|
101
|
-
// PostCSS 플러그인 로딩 (튜플 → 인스턴스)
|
|
102
|
-
let loadedPostcssPlugins: AcceptedPlugin[] | undefined;
|
|
103
|
-
if (options.postcssPlugins != null && options.postcssPlugins.length > 0) {
|
|
104
|
-
const req = createRequire(path.join(options.pkgDir, "package.json"));
|
|
105
|
-
loadedPostcssPlugins = options.postcssPlugins.map(([name, pluginOpts]) => {
|
|
106
|
-
const pluginFn = req(name);
|
|
107
|
-
const fn = pluginFn.default ?? pluginFn;
|
|
108
|
-
return pluginOpts != null ? fn(pluginOpts) : fn;
|
|
109
|
-
});
|
|
110
|
-
}
|
|
126
|
+
const angularPlugin = createAngularCompilerPlugin(pluginOptions);
|
|
111
127
|
|
|
112
128
|
// SCSS side-effect import 처리 플러그인
|
|
113
129
|
const scssPlugin = createScssPlugin({
|
|
@@ -172,7 +188,7 @@ export async function createClientEsbuildContext(
|
|
|
172
188
|
metafile: true,
|
|
173
189
|
write: true,
|
|
174
190
|
sourcemap: isDev ? "linked" : false,
|
|
175
|
-
logLevel:
|
|
191
|
+
logLevel: "silent",
|
|
176
192
|
tsconfig: options.tsconfig ?? path.join(options.pkgDir, "tsconfig.json"),
|
|
177
193
|
define,
|
|
178
194
|
banner: hmrBanner != null ? { js: hmrBanner } : undefined,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type esbuild from "esbuild";
|
|
2
2
|
import type ts from "typescript";
|
|
3
3
|
import { err as errNs } from "@simplysm/core-common";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { SdTsCompiler } from "../ts-compiler/SdTsCompiler";
|
|
5
|
+
import type { ISdTsCompilerResult } from "../ts-compiler/sd-ts-compiler-result";
|
|
6
6
|
import type { SerializedDiagnostic } from "../typecheck/typecheck-serialization";
|
|
7
|
+
import type { LintWithProgramResult } from "../lint/lint-with-program";
|
|
8
|
+
import type { TypecheckEnv } from "../utils/tsconfig";
|
|
7
9
|
|
|
8
10
|
export interface TscPluginOptions {
|
|
9
11
|
pkgDir: string;
|
|
@@ -11,6 +13,7 @@ export interface TscPluginOptions {
|
|
|
11
13
|
output: { dts: boolean };
|
|
12
14
|
env?: TypecheckEnv;
|
|
13
15
|
includeTests?: boolean;
|
|
16
|
+
lint?: boolean;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
export interface TscPluginResult {
|
|
@@ -19,6 +22,7 @@ export interface TscPluginResult {
|
|
|
19
22
|
getAffectedFiles(): ReadonlySet<string> | undefined;
|
|
20
23
|
getDiagnostics(): SerializedDiagnostic[];
|
|
21
24
|
getErrors(): string[] | undefined;
|
|
25
|
+
getLintResult(): LintWithProgramResult | undefined;
|
|
22
26
|
resetBuilderProgram(): void;
|
|
23
27
|
}
|
|
24
28
|
|
|
@@ -28,43 +32,48 @@ export function createTscPlugin(options: TscPluginOptions): TscPluginResult {
|
|
|
28
32
|
let lastAffectedFiles: ReadonlySet<string> | undefined;
|
|
29
33
|
let lastDiagnostics: SerializedDiagnostic[] = [];
|
|
30
34
|
let lastErrors: string[] | undefined;
|
|
31
|
-
let
|
|
35
|
+
let lastLintResult: LintWithProgramResult | undefined;
|
|
32
36
|
|
|
33
|
-
//
|
|
34
|
-
let
|
|
37
|
+
// SdTsCompiler 인스턴스 (lazy 생성, resetBuilderProgram 시 재생성)
|
|
38
|
+
let compiler: SdTsCompiler | undefined;
|
|
39
|
+
|
|
40
|
+
// onStart에서 생성한 compile Promise (onEnd에서 await)
|
|
41
|
+
let compilePromise: Promise<ISdTsCompilerResult> | undefined;
|
|
35
42
|
|
|
36
43
|
const plugin: esbuild.Plugin = {
|
|
37
44
|
name: "sd-tsc",
|
|
38
45
|
setup(build) {
|
|
39
46
|
build.onStart(() => {
|
|
40
47
|
// microtask로 tsc 스케줄링 (await하지 않음)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
48
|
+
compilePromise = Promise.resolve().then(() => {
|
|
49
|
+
if (compiler == null) {
|
|
50
|
+
compiler = new SdTsCompiler({
|
|
51
|
+
pkgDir: options.pkgDir,
|
|
52
|
+
cwd: options.cwd,
|
|
53
|
+
output: { js: false, dts: options.output.dts },
|
|
54
|
+
env: options.env,
|
|
55
|
+
includeTests: options.includeTests,
|
|
56
|
+
lint: options.lint,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return compiler.compileAsync();
|
|
52
60
|
});
|
|
53
61
|
});
|
|
54
62
|
|
|
55
63
|
build.onEnd(async () => {
|
|
56
64
|
try {
|
|
57
|
-
const
|
|
58
|
-
lastProgram =
|
|
59
|
-
lastAffectedFiles =
|
|
60
|
-
lastDiagnostics =
|
|
61
|
-
lastErrors =
|
|
62
|
-
|
|
65
|
+
const result = await compilePromise!;
|
|
66
|
+
lastProgram = result.program;
|
|
67
|
+
lastAffectedFiles = result.affectedFiles;
|
|
68
|
+
lastDiagnostics = result.diagnostics;
|
|
69
|
+
lastErrors = result.errors;
|
|
70
|
+
lastLintResult = result.lint;
|
|
63
71
|
} catch (err) {
|
|
64
72
|
lastProgram = undefined;
|
|
65
73
|
lastAffectedFiles = undefined;
|
|
66
74
|
lastDiagnostics = [];
|
|
67
75
|
lastErrors = [errNs.message(err)];
|
|
76
|
+
lastLintResult = undefined;
|
|
68
77
|
}
|
|
69
78
|
});
|
|
70
79
|
},
|
|
@@ -76,8 +85,9 @@ export function createTscPlugin(options: TscPluginOptions): TscPluginResult {
|
|
|
76
85
|
getAffectedFiles: () => lastAffectedFiles,
|
|
77
86
|
getDiagnostics: () => lastDiagnostics,
|
|
78
87
|
getErrors: () => lastErrors,
|
|
88
|
+
getLintResult: () => lastLintResult,
|
|
79
89
|
resetBuilderProgram: () => {
|
|
80
|
-
|
|
90
|
+
compiler = undefined;
|
|
81
91
|
},
|
|
82
92
|
};
|
|
83
93
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { normalize } from "path";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 리소스 파일 의존성을 추적하여 증분 빌드 시 전이적 무효화를 지원한다.
|
|
5
|
+
*
|
|
6
|
+
* referencedFile → Set<containingFile> 역방향 맵을 유지한다.
|
|
7
|
+
* containingFile이 referencedFile을 참조하므로, referencedFile이 변경되면
|
|
8
|
+
* containingFile도 재컴파일 대상에 포함되어야 한다.
|
|
9
|
+
*/
|
|
10
|
+
export class FileReferenceTracker {
|
|
11
|
+
private readonly _referencingFiles = new Map<string, Set<string>>();
|
|
12
|
+
|
|
13
|
+
/** 추적 중인 모든 참조 파일(키)의 이터레이터 */
|
|
14
|
+
get referencedFiles(): IterableIterator<string> {
|
|
15
|
+
return this._referencingFiles.keys();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* containingFile이 referencedFiles를 참조한다는 의존성을 등록한다.
|
|
20
|
+
* 자기 참조(containingFile === referencedFile)는 무시한다.
|
|
21
|
+
*/
|
|
22
|
+
add(containingFile: string, referencedFiles: Iterable<string>): void {
|
|
23
|
+
const normalizedContaining = normalize(containingFile);
|
|
24
|
+
for (const file of referencedFiles) {
|
|
25
|
+
const normalizedRef = normalize(file);
|
|
26
|
+
if (normalizedRef === normalizedContaining) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
let referencing = this._referencingFiles.get(normalizedRef);
|
|
30
|
+
if (referencing == null) {
|
|
31
|
+
referencing = new Set([normalizedContaining]);
|
|
32
|
+
this._referencingFiles.set(normalizedRef, referencing);
|
|
33
|
+
} else {
|
|
34
|
+
referencing.add(normalizedContaining);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 변경된 파일 집합에 대해 전이적으로 영향받는 파일을 확장하여 반환한다.
|
|
41
|
+
* 확장이 없으면 원본 Set을 그대로 반환한다.
|
|
42
|
+
* 확장된 참조 레코드는 stale로 간주하여 정리한다.
|
|
43
|
+
*/
|
|
44
|
+
update(changed: Set<string>): Set<string> {
|
|
45
|
+
let allChanged: Set<string> | undefined;
|
|
46
|
+
|
|
47
|
+
for (const modifiedFile of changed) {
|
|
48
|
+
const normalizedModified = normalize(modifiedFile);
|
|
49
|
+
const referencing = this._referencingFiles.get(normalizedModified);
|
|
50
|
+
if (referencing != null) {
|
|
51
|
+
allChanged ??= new Set(changed);
|
|
52
|
+
for (const referencingFile of referencing) {
|
|
53
|
+
allChanged.add(referencingFile);
|
|
54
|
+
}
|
|
55
|
+
this._referencingFiles.delete(normalizedModified);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return allChanged ?? changed;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { open, type Database } from "lmdb";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* lmdb 기반 persistent key-value 캐시 스토어.
|
|
5
|
+
* JavaScriptTransformer의 JS 변환 결과를 디스크에 캐싱하여
|
|
6
|
+
* 프로세스 재시작 후에도 캐시를 재사용한다.
|
|
7
|
+
*
|
|
8
|
+
* @angular/build의 CacheStore 인터페이스와 구조적으로 호환된다.
|
|
9
|
+
*/
|
|
10
|
+
export class LmdbCacheStore<V = unknown> {
|
|
11
|
+
private readonly _cachePath: string;
|
|
12
|
+
private _db: Database | undefined;
|
|
13
|
+
|
|
14
|
+
constructor(cachePath: string) {
|
|
15
|
+
this._cachePath = cachePath;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private _ensureDb(): Database {
|
|
19
|
+
this._db ??= open({
|
|
20
|
+
path: this._cachePath,
|
|
21
|
+
compression: true,
|
|
22
|
+
});
|
|
23
|
+
return this._db;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get(key: string): V | undefined {
|
|
27
|
+
return this._ensureDb().get(key) as V | undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
has(key: string): boolean {
|
|
31
|
+
return this._ensureDb().doesExist(key);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async set(key: string, value: V): Promise<this> {
|
|
35
|
+
await this._ensureDb().put(key, value);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async close(): Promise<void> {
|
|
40
|
+
try {
|
|
41
|
+
await this._db?.close();
|
|
42
|
+
} catch {
|
|
43
|
+
// close 실패는 치명적이지 않음
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import type { OnLoadResult, PluginBuild } from "esbuild";
|
|
3
|
+
|
|
4
|
+
export interface LoadResultCache {
|
|
5
|
+
get(path: string): OnLoadResult | undefined;
|
|
6
|
+
put(path: string, result: OnLoadResult): void | Promise<void>;
|
|
7
|
+
invalidate(path: string): boolean;
|
|
8
|
+
readonly watchFiles: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function createCachedLoad(
|
|
12
|
+
cache: LoadResultCache | undefined,
|
|
13
|
+
callback: Parameters<PluginBuild["onLoad"]>[1],
|
|
14
|
+
): Parameters<PluginBuild["onLoad"]>[1] {
|
|
15
|
+
if (cache == null) {
|
|
16
|
+
return callback;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return async (args) => {
|
|
20
|
+
const loadCacheKey = `${args.namespace}:${args.path}`;
|
|
21
|
+
let result: OnLoadResult | null | undefined = cache.get(loadCacheKey);
|
|
22
|
+
|
|
23
|
+
if (result == null) {
|
|
24
|
+
result = (await callback(args)) ?? null;
|
|
25
|
+
|
|
26
|
+
// null/undefined는 캐싱하지 않는다
|
|
27
|
+
if (result != null) {
|
|
28
|
+
// file namespace일 때 watchFiles에 요청 경로를 자동 추가
|
|
29
|
+
if (args.namespace === "file") {
|
|
30
|
+
result.watchFiles ??= [];
|
|
31
|
+
result.watchFiles.push(args.path);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
await cache.put(loadCacheKey, result);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class MemoryLoadResultCache implements LoadResultCache {
|
|
43
|
+
private readonly _loadResults = new Map<string, OnLoadResult>();
|
|
44
|
+
private readonly _fileDependencies = new Map<string, Set<string>>();
|
|
45
|
+
|
|
46
|
+
get(key: string): OnLoadResult | undefined {
|
|
47
|
+
return this._loadResults.get(key);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
put(key: string, result: OnLoadResult): void {
|
|
51
|
+
this._loadResults.set(key, result);
|
|
52
|
+
|
|
53
|
+
if (result.watchFiles != null) {
|
|
54
|
+
for (const watchFile of result.watchFiles) {
|
|
55
|
+
const normalizedWatchFile = path.normalize(watchFile);
|
|
56
|
+
let affected = this._fileDependencies.get(normalizedWatchFile);
|
|
57
|
+
if (affected == null) {
|
|
58
|
+
affected = new Set();
|
|
59
|
+
this._fileDependencies.set(normalizedWatchFile, affected);
|
|
60
|
+
}
|
|
61
|
+
affected.add(key);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
invalidate(filePath: string): boolean {
|
|
67
|
+
const affectedKeys = this._fileDependencies.get(filePath);
|
|
68
|
+
let found = false;
|
|
69
|
+
|
|
70
|
+
if (affectedKeys != null) {
|
|
71
|
+
for (const affected of affectedKeys) {
|
|
72
|
+
if (this._loadResults.delete(affected)) {
|
|
73
|
+
found = true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
this._fileDependencies.delete(filePath);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return found;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
get watchFiles(): string[] {
|
|
83
|
+
return [...this._fileDependencies.keys()];
|
|
84
|
+
}
|
|
85
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -3,3 +3,8 @@ export * from "./sd-config.types";
|
|
|
3
3
|
|
|
4
4
|
// Angular Vite Plugin
|
|
5
5
|
export { sdAngularPlugin, type SdAngularPluginOptions } from "./angular/vite-angular-plugin";
|
|
6
|
+
|
|
7
|
+
// TypeScript Compiler
|
|
8
|
+
export { SdTsCompiler } from "./ts-compiler/SdTsCompiler";
|
|
9
|
+
export type { ISdTsCompilerOptions } from "./ts-compiler/sd-ts-compiler-options";
|
|
10
|
+
export type { ISdTsCompilerResult } from "./ts-compiler/sd-ts-compiler-result";
|
package/src/lint/lint-core.ts
CHANGED
|
@@ -130,13 +130,13 @@ export async function executeLint(options: LintOptions): Promise<LintResult> {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
// ESLint 설정 로드
|
|
133
|
-
logger.
|
|
133
|
+
logger.debug("ESLint 설정 로딩 중");
|
|
134
134
|
const ignorePatterns = await loadIgnorePatterns(cwd);
|
|
135
135
|
logger.debug("무시 패턴 로드 완료", { ignorePatternCount: ignorePatterns.length });
|
|
136
|
-
logger.
|
|
136
|
+
logger.debug(`ESLint 설정 로드 완료 (${ignorePatterns.length}개 무시 패턴)`);
|
|
137
137
|
|
|
138
138
|
// 린트 대상 파일 수집
|
|
139
|
-
logger.
|
|
139
|
+
logger.debug("린트 대상 파일 수집 중");
|
|
140
140
|
let files = await fsx.glob("**/*.{ts,js,mjs,cjs}", {
|
|
141
141
|
cwd,
|
|
142
142
|
ignore: ignorePatterns,
|
|
@@ -145,19 +145,19 @@ export async function executeLint(options: LintOptions): Promise<LintResult> {
|
|
|
145
145
|
});
|
|
146
146
|
files = pathx.filterByTargets(files, targets, cwd);
|
|
147
147
|
logger.debug("파일 수집 완료", { fileCount: files.length });
|
|
148
|
-
logger.
|
|
148
|
+
logger.debug(`린트 대상 파일 수집 완료 (${files.length}개 파일)`);
|
|
149
149
|
|
|
150
150
|
// 린트 실행
|
|
151
151
|
let eslint: ESLint | undefined;
|
|
152
152
|
let eslintResults: ESLint.LintResult[] | undefined;
|
|
153
153
|
if (files.length > 0) {
|
|
154
|
-
logger.
|
|
154
|
+
logger.debug(`린트 실행 중... (${files.length}개 파일)`);
|
|
155
155
|
eslint = new ESLint({
|
|
156
156
|
cwd,
|
|
157
157
|
fix,
|
|
158
158
|
});
|
|
159
159
|
eslintResults = await eslint.lintFiles(files);
|
|
160
|
-
logger.
|
|
160
|
+
logger.debug("린트 실행 완료");
|
|
161
161
|
|
|
162
162
|
// 자동 수정 적용
|
|
163
163
|
if (fix) {
|
|
@@ -180,7 +180,7 @@ export async function executeLint(options: LintOptions): Promise<LintResult> {
|
|
|
180
180
|
if (errorCount > 0) {
|
|
181
181
|
logger.error("린트 에러 발생", { errorCount, warningCount });
|
|
182
182
|
} else {
|
|
183
|
-
logger.
|
|
183
|
+
logger.success("린트 완료", { errorCount, warningCount });
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
// 포매터 출력 수집
|
|
@@ -102,9 +102,9 @@ export abstract class BaseOrchestrator {
|
|
|
102
102
|
this._replaceDepWatcher = undefined;
|
|
103
103
|
|
|
104
104
|
if (!this._hasPackages) return;
|
|
105
|
-
|
|
105
|
+
this._logger.start("종료 중...");
|
|
106
106
|
await this._shutdownMode();
|
|
107
|
-
|
|
107
|
+
this._logger.success("종료 완료");
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
protected abstract _initializeMode(
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
1
|
import { fsx, pathx } from "@simplysm/core-node";
|
|
3
2
|
import { consola } from "consola";
|
|
4
3
|
import type {
|
|
@@ -9,10 +8,8 @@ import type {
|
|
|
9
8
|
} from "../sd-config.types";
|
|
10
9
|
import { loadAndValidateConfig } from "../utils/orchestrator-utils";
|
|
11
10
|
import { getVersion } from "../utils/build-env";
|
|
12
|
-
import { deserializeDiagnostic } from "../typecheck/typecheck-serialization";
|
|
13
11
|
import { copySrcFiles } from "../utils/copy-src";
|
|
14
12
|
import { formatBuildMessages } from "../utils/output-utils";
|
|
15
|
-
import { formatDiagnosticsOutput } from "../utils/diagnostic-utils";
|
|
16
13
|
import { createBuildEngine } from "../engines/engine-factory";
|
|
17
14
|
import type { BuildOutput, BuildPackageInfo, ClientPackageInfo, ServerPackageInfo } from "../engines/types";
|
|
18
15
|
import { runWithConcurrency, getMaxConcurrency } from "../utils/concurrency";
|
|
@@ -43,7 +40,6 @@ interface BuildStepResult {
|
|
|
43
40
|
success: boolean;
|
|
44
41
|
errors?: string[];
|
|
45
42
|
warnings?: string[];
|
|
46
|
-
diagnostics?: ts.Diagnostic[];
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
/**
|
|
@@ -174,7 +170,7 @@ export class BuildOrchestrator implements OrchestratorLifecycle<boolean> {
|
|
|
174
170
|
];
|
|
175
171
|
|
|
176
172
|
if (this._allPackageNames.length === 0) {
|
|
177
|
-
|
|
173
|
+
this._logger.info("빌드할 패키지가 없습니다.");
|
|
178
174
|
return;
|
|
179
175
|
}
|
|
180
176
|
|
|
@@ -252,8 +248,6 @@ export class BuildOrchestrator implements OrchestratorLifecycle<boolean> {
|
|
|
252
248
|
hasUntrackedError.value = true;
|
|
253
249
|
}
|
|
254
250
|
}
|
|
255
|
-
this._logger.success("빌드 실행 완료");
|
|
256
|
-
|
|
257
251
|
return { results, hasUntrackedError: hasUntrackedError.value };
|
|
258
252
|
}
|
|
259
253
|
|
|
@@ -282,9 +276,6 @@ export class BuildOrchestrator implements OrchestratorLifecycle<boolean> {
|
|
|
282
276
|
try {
|
|
283
277
|
const engineResult = await engine.run(params.output);
|
|
284
278
|
|
|
285
|
-
const diagnostics = engineResult.build.diagnostics.map((d) =>
|
|
286
|
-
deserializeDiagnostic(d, params.fileCache),
|
|
287
|
-
);
|
|
288
279
|
return {
|
|
289
280
|
name: params.name,
|
|
290
281
|
target: params.target,
|
|
@@ -293,7 +284,6 @@ export class BuildOrchestrator implements OrchestratorLifecycle<boolean> {
|
|
|
293
284
|
errors: engineResult.build.errors.length > 0 ? engineResult.build.errors : undefined,
|
|
294
285
|
warnings:
|
|
295
286
|
engineResult.build.warnings.length > 0 ? engineResult.build.warnings : undefined,
|
|
296
|
-
diagnostics,
|
|
297
287
|
};
|
|
298
288
|
} finally {
|
|
299
289
|
await engine.stop();
|
|
@@ -316,7 +306,7 @@ export class BuildOrchestrator implements OrchestratorLifecycle<boolean> {
|
|
|
316
306
|
name,
|
|
317
307
|
target: config.target,
|
|
318
308
|
config,
|
|
319
|
-
output: { js: true, dts: true, lint: false },
|
|
309
|
+
output: { js: true, dts: true, lint: false, includeTests: false },
|
|
320
310
|
fileCache,
|
|
321
311
|
});
|
|
322
312
|
results.push(result);
|
|
@@ -349,7 +339,7 @@ export class BuildOrchestrator implements OrchestratorLifecycle<boolean> {
|
|
|
349
339
|
name,
|
|
350
340
|
target: "server",
|
|
351
341
|
config: { ...config, env: { ...baseEnv, ...config.env } },
|
|
352
|
-
output: { js: true, dts: false, lint: false },
|
|
342
|
+
output: { js: true, dts: false, lint: false, includeTests: false },
|
|
353
343
|
fileCache,
|
|
354
344
|
});
|
|
355
345
|
results.push(result);
|
|
@@ -385,7 +375,7 @@ export class BuildOrchestrator implements OrchestratorLifecycle<boolean> {
|
|
|
385
375
|
name,
|
|
386
376
|
target: "client",
|
|
387
377
|
config: { ...config, env: { ...baseEnv, ...config.env } },
|
|
388
|
-
output: { js: true, dts: false, lint: false },
|
|
378
|
+
output: { js: true, dts: false, lint: false, includeTests: false },
|
|
389
379
|
engineOptions: { outDir, base: isNativeBuild ? "" : undefined },
|
|
390
380
|
fileCache,
|
|
391
381
|
});
|
|
@@ -462,7 +452,6 @@ export class BuildOrchestrator implements OrchestratorLifecycle<boolean> {
|
|
|
462
452
|
results: BuildStepResult[],
|
|
463
453
|
hasUntrackedError: boolean,
|
|
464
454
|
): boolean {
|
|
465
|
-
const allDiagnostics: ts.Diagnostic[] = [];
|
|
466
455
|
for (const result of results) {
|
|
467
456
|
const typeLabel = result.type === "lint" ? "lint" : result.target;
|
|
468
457
|
|
|
@@ -477,14 +466,6 @@ export class BuildOrchestrator implements OrchestratorLifecycle<boolean> {
|
|
|
477
466
|
this._logger.error(`[${result.name}] (${typeLabel}) 실패`);
|
|
478
467
|
}
|
|
479
468
|
}
|
|
480
|
-
if (result.diagnostics != null) {
|
|
481
|
-
allDiagnostics.push(...result.diagnostics);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
const diagnosticMessage = formatDiagnosticsOutput(allDiagnostics, this._cwd);
|
|
486
|
-
if (diagnosticMessage !== "") {
|
|
487
|
-
process.stdout.write(diagnosticMessage);
|
|
488
469
|
}
|
|
489
470
|
|
|
490
471
|
const errorCount = results.filter((r) => !r.success).length;
|
|
@@ -493,7 +474,7 @@ export class BuildOrchestrator implements OrchestratorLifecycle<boolean> {
|
|
|
493
474
|
if (hasError) {
|
|
494
475
|
this._logger.error("빌드 에러 발생", { errorCount, warningCount });
|
|
495
476
|
} else {
|
|
496
|
-
this._logger.
|
|
477
|
+
this._logger.success("빌드 완료", { errorCount, warningCount });
|
|
497
478
|
}
|
|
498
479
|
|
|
499
480
|
return hasError;
|
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
SdServerPackageConfig,
|
|
7
7
|
} from "../sd-config.types";
|
|
8
8
|
import { filterPackagesByTargets, classifyDevPackages } from "../utils/package-classify";
|
|
9
|
-
import {
|
|
9
|
+
import { printDiagnostics, printServers } from "../utils/output-utils";
|
|
10
10
|
import { createBuildEngine } from "../engines/engine-factory";
|
|
11
11
|
import type { BuildEngine, ClientPackageInfo, ServerPackageInfo } from "../engines/types";
|
|
12
12
|
import { Capacitor } from "../capacitor/capacitor";
|
|
@@ -130,14 +130,14 @@ export class DevOrchestrator extends BaseOrchestrator implements OrchestratorLif
|
|
|
130
130
|
for (const [name, engine] of this._clientEngines) {
|
|
131
131
|
initialBuildPromises.push({
|
|
132
132
|
name: `${name} (client)`,
|
|
133
|
-
promise: engine.startWatch({ js: true, dts: false, lint: false }),
|
|
133
|
+
promise: engine.startWatch({ js: true, dts: false, lint: false, includeTests: false }),
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
for (const [name, engine] of this._serverEngines) {
|
|
138
138
|
initialBuildPromises.push({
|
|
139
139
|
name: `${name} (server)`,
|
|
140
|
-
promise: engine.startWatch({ js: true, dts: false, lint: false }),
|
|
140
|
+
promise: engine.startWatch({ js: true, dts: false, lint: false, includeTests: false }),
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -217,7 +217,7 @@ export class DevOrchestrator extends BaseOrchestrator implements OrchestratorLif
|
|
|
217
217
|
this._logger.debug(`배치 완료 (${completedKeys.join(", ")})`);
|
|
218
218
|
const serverBuildKeys = this._serverPackages.map((p) => `${p.name}:build`);
|
|
219
219
|
if (!completedKeys.some((k) => serverBuildKeys.includes(k))) {
|
|
220
|
-
|
|
220
|
+
printDiagnostics(this._resultCollector.toMap());
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
223
223
|
|
|
@@ -259,7 +259,7 @@ export class DevOrchestrator extends BaseOrchestrator implements OrchestratorLif
|
|
|
259
259
|
}
|
|
260
260
|
await Promise.all(restartPromises);
|
|
261
261
|
this._logger.debug("서버 재시작 완료");
|
|
262
|
-
|
|
262
|
+
printDiagnostics(this._resultCollector.toMap());
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
private _schedulePrintServers(): void {
|