@simplysm/sd-cli 14.0.42 → 14.0.44
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 +41 -37
- package/dist/angular/ngtsc-build-core.d.ts.map +1 -1
- package/dist/angular/ngtsc-build-core.js +155 -52
- 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.d.ts.map +1 -1
- package/dist/commands/publish/version-upgrade.js +16 -13
- 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-resolve.d.ts.map +1 -1
- package/dist/deps/replace-deps/replace-deps-resolve.js +6 -7
- package/dist/deps/replace-deps/replace-deps-resolve.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 +175 -66
- 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-postcss-plugin.d.ts.map +1 -1
- package/dist/esbuild/esbuild-postcss-plugin.js +9 -6
- package/dist/esbuild/esbuild-postcss-plugin.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 +115 -110
- package/dist/workers/client.worker.js.map +1 -1
- package/dist/workers/incremental-mtime-tracker.d.ts +13 -0
- package/dist/workers/incremental-mtime-tracker.d.ts.map +1 -0
- package/dist/workers/incremental-mtime-tracker.js +65 -0
- package/dist/workers/incremental-mtime-tracker.js.map +1 -0
- 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 +169 -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 +5 -4
- package/src/angular/angular-compiler.ts +0 -502
- package/src/angular/hmr-candidates.ts +295 -0
- package/src/angular/ngtsc-build-core.ts +192 -91
- 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 +44 -35
- 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-resolve.ts +12 -7
- package/src/deps/replace-deps/replace-deps.ts +191 -69
- 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-postcss-plugin.ts +9 -6
- 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 +141 -126
- package/src/workers/incremental-mtime-tracker.ts +68 -0
- package/src/workers/library-build.worker.ts +214 -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/ngtsc-build-core.acc.spec.ts +210 -0
- package/tests/angular/ngtsc-build-core.spec.ts +52 -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/commands/version-upgrade.acc.spec.ts +210 -0
- package/tests/commands/version-upgrade.spec.ts +148 -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-perf.verify.md +15 -0
- package/tests/deps/replace-deps/replace-deps-resolve.acc.spec.ts +124 -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-postcss-plugin-chunking.verify.md +17 -0
- package/tests/esbuild/esbuild-postcss-plugin.acc.spec.ts +152 -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/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 +136 -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-mtime-incremental.verify.md +10 -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/incremental-mtime-tracker.acc.spec.ts +144 -0
- package/tests/workers/incremental-mtime-tracker.spec.ts +102 -0
- package/tests/workers/library-build-lint.spec.ts +40 -45
- package/tests/workers/library-build-worker.spec.ts +298 -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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import esbuild from "esbuild";
|
|
2
2
|
import { err as errNs } from "@simplysm/core-common";
|
|
3
|
+
import { formatEsbuildMessages } from "../utils/output-utils.js";
|
|
3
4
|
import { createServerEsbuildOptions, writeChangedOutputFiles, } from "../esbuild/esbuild-config.js";
|
|
4
5
|
import { createTscPlugin } from "../esbuild/esbuild-tsc-plugin.js";
|
|
5
6
|
/** esbuild watch context (모듈 스코프 상태) */
|
|
@@ -20,6 +21,7 @@ export async function createContext(options) {
|
|
|
20
21
|
output: options.tsc.output,
|
|
21
22
|
env: options.tsc.env,
|
|
22
23
|
includeTests: options.tsc.includeTests,
|
|
24
|
+
lint: options.tsc.lint,
|
|
23
25
|
});
|
|
24
26
|
}
|
|
25
27
|
const baseOptions = createServerEsbuildOptions({
|
|
@@ -62,10 +64,10 @@ export async function rebuild() {
|
|
|
62
64
|
if (result.outputFiles) {
|
|
63
65
|
await writeChangedOutputFiles(result.outputFiles);
|
|
64
66
|
}
|
|
65
|
-
const esbuildErrors = result.errors
|
|
67
|
+
const esbuildErrors = formatEsbuildMessages(result.errors, "error");
|
|
66
68
|
const tscErrors = tscPlugin?.getErrors() ?? [];
|
|
67
69
|
const allErrors = [...esbuildErrors, ...tscErrors];
|
|
68
|
-
const warnings = result.warnings
|
|
70
|
+
const warnings = formatEsbuildMessages(result.warnings, "warning");
|
|
69
71
|
return {
|
|
70
72
|
success: allErrors.length === 0,
|
|
71
73
|
errors: allErrors.length > 0 ? allErrors : undefined,
|
|
@@ -142,4 +144,11 @@ export function getTscAffectedFiles() {
|
|
|
142
144
|
export function getTscDiagnostics() {
|
|
143
145
|
return tscPlugin?.getDiagnostics() ?? [];
|
|
144
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* tsc 플러그인의 lint 결과를 반환한다.
|
|
149
|
+
* 플러그인이 없거나 lint가 비활성이면 undefined를 반환한다.
|
|
150
|
+
*/
|
|
151
|
+
export function getTscLintResult() {
|
|
152
|
+
return tscPlugin?.getLintResult();
|
|
153
|
+
}
|
|
145
154
|
//# sourceMappingURL=server-esbuild-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-esbuild-context.js","sourceRoot":"","sources":["../../src/workers/server-esbuild-context.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,GAAG,IAAI,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAwB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"server-esbuild-context.js","sourceRoot":"","sources":["../../src/workers/server-esbuild-context.ts"],"names":[],"mappings":"AACA,OAAO,OA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AAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,SAAS,EAAE,gBAAgB,EAAE,CAAC;AACvC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,SAAS,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;AAC3C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,SAAS,EAAE,aAAa,EAAE,CAAC;AACpC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/sd-cli",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.44",
|
|
4
4
|
"description": "Simplysm package - CLI tool",
|
|
5
5
|
"author": "simplysm",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"eslint": "^9.39.4",
|
|
32
32
|
"glob": "^13.0.6",
|
|
33
33
|
"jiti": "^2.6.1",
|
|
34
|
+
"lmdb": "^3.5.1",
|
|
34
35
|
"mime": "^4.1.0",
|
|
35
36
|
"postcss": "^8.5.9",
|
|
36
37
|
"sass": "^1.99.0",
|
|
@@ -40,9 +41,9 @@
|
|
|
40
41
|
"typescript": "^5.9.3",
|
|
41
42
|
"ws": "^8.20.0",
|
|
42
43
|
"yargs": "^18.0.0",
|
|
43
|
-
"@simplysm/core-common": "14.0.
|
|
44
|
-
"@simplysm/core-node": "14.0.
|
|
45
|
-
"@simplysm/storage": "14.0.
|
|
44
|
+
"@simplysm/core-common": "14.0.44",
|
|
45
|
+
"@simplysm/core-node": "14.0.44",
|
|
46
|
+
"@simplysm/storage": "14.0.44"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@types/semver": "^7.7.1",
|
|
@@ -1,32 +1,5 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { createHash } from "crypto";
|
|
3
1
|
import ts from "typescript";
|
|
4
|
-
import { consola } from "consola";
|
|
5
2
|
import { pathx } from "@simplysm/core-node";
|
|
6
|
-
import { NgtscProgram, OptimizeFor } from "./angular-build";
|
|
7
|
-
|
|
8
|
-
const logger = consola.withTag("sd:cli:angular-compiler");
|
|
9
|
-
|
|
10
|
-
// NgCompiler 타입은 NgtscProgram.compiler에서 추론한다 (exports 제한으로 직접 import 불가할 수 있음)
|
|
11
|
-
type NgCompiler = NgtscProgram["compiler"];
|
|
12
|
-
|
|
13
|
-
function hasTemplateExtension(file: string): boolean {
|
|
14
|
-
const ext = path.extname(file).toLowerCase();
|
|
15
|
-
return ext === ".htm" || ext === ".html" || ext === ".svg";
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function ensureSourceFileVersions(program: ts.Program): void {
|
|
19
|
-
const baseGetSourceFiles = program.getSourceFiles;
|
|
20
|
-
program.getSourceFiles = function (...parameters: Parameters<typeof baseGetSourceFiles>) {
|
|
21
|
-
const files = baseGetSourceFiles.apply(this, parameters);
|
|
22
|
-
for (const file of files) {
|
|
23
|
-
if ((file as unknown as { version?: string }).version === undefined) {
|
|
24
|
-
(file as unknown as { version: string }).version = createHash("sha256").update(file.text).digest("hex");
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return files;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
3
|
|
|
31
4
|
export interface EmitResult {
|
|
32
5
|
filename: string;
|
|
@@ -45,20 +18,6 @@ export interface EmitOptions {
|
|
|
45
18
|
};
|
|
46
19
|
}
|
|
47
20
|
|
|
48
|
-
export interface AngularCompilerOptions {
|
|
49
|
-
rootNames: string[];
|
|
50
|
-
compilerOptions: ts.CompilerOptions;
|
|
51
|
-
angularCompilerOptions?: Record<string, unknown>;
|
|
52
|
-
sourceFileCache?: AngularSourceFileCache;
|
|
53
|
-
transformStylesheet?: (
|
|
54
|
-
data: string,
|
|
55
|
-
containingFile: string,
|
|
56
|
-
stylesheetFile?: string,
|
|
57
|
-
) => Promise<string | null>;
|
|
58
|
-
compilerOptionsTransformer?: (options: ts.CompilerOptions) => ts.CompilerOptions;
|
|
59
|
-
externalStylesheets?: Map<string, string>;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
21
|
export class AngularSourceFileCache extends Map<string, ts.SourceFile> {
|
|
63
22
|
readonly modifiedFiles = new Set<string>();
|
|
64
23
|
|
|
@@ -101,464 +60,3 @@ export function augmentHostWithCaching(
|
|
|
101
60
|
};
|
|
102
61
|
}
|
|
103
62
|
|
|
104
|
-
export class AngularCompiler {
|
|
105
|
-
// ── 설정 (불변) ──
|
|
106
|
-
private readonly _options: AngularCompilerOptions;
|
|
107
|
-
|
|
108
|
-
// ── 컴파일 상태 (initialize마다 재생성) ──
|
|
109
|
-
private _ngtscProgram?: NgtscProgram;
|
|
110
|
-
private _builderProgram?: ts.EmitAndSemanticDiagnosticsBuilderProgram;
|
|
111
|
-
private _host?: ts.CompilerHost;
|
|
112
|
-
private _affectedFiles = new Set<ts.SourceFile>();
|
|
113
|
-
|
|
114
|
-
// ── 영속 상태 (initialize 간 재사용) ──
|
|
115
|
-
private readonly _diagnosticCache = new WeakMap<ts.SourceFile, ts.Diagnostic[]>();
|
|
116
|
-
private _packageJsonCache?: ts.PackageJsonInfoCache;
|
|
117
|
-
|
|
118
|
-
constructor(options: AngularCompilerOptions) {
|
|
119
|
-
this._options = options;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
updateRootNames(rootNames: string[]): void {
|
|
123
|
-
this._options.rootNames = rootNames;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
get ngtscProgram(): NgtscProgram | undefined {
|
|
127
|
-
return this._ngtscProgram;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
get compiler(): NgCompiler {
|
|
131
|
-
if (this._ngtscProgram == null) {
|
|
132
|
-
throw new Error("initialize()를 먼저 호출해야 합니다");
|
|
133
|
-
}
|
|
134
|
-
return this._ngtscProgram.compiler;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
getTsProgram(): ts.Program {
|
|
138
|
-
if (this._ngtscProgram == null) {
|
|
139
|
-
throw new Error("initialize()를 먼저 호출해야 합니다");
|
|
140
|
-
}
|
|
141
|
-
return this._ngtscProgram.getTsProgram();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
async initialize(): Promise<{
|
|
145
|
-
affectedFiles: ReadonlySet<ts.SourceFile>;
|
|
146
|
-
}> {
|
|
147
|
-
const options = this._options;
|
|
148
|
-
const sourceFileCache = options.sourceFileCache;
|
|
149
|
-
|
|
150
|
-
// 1. packageJsonCache 관리
|
|
151
|
-
if (sourceFileCache != null && this._packageJsonCache != null) {
|
|
152
|
-
let shouldClear = false;
|
|
153
|
-
for (const modifiedFile of sourceFileCache.modifiedFiles) {
|
|
154
|
-
if (modifiedFile.includes("node_modules")) {
|
|
155
|
-
shouldClear = true;
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
if (shouldClear) {
|
|
160
|
-
this._packageJsonCache.clear();
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// 2. compilerOptionsTransformer 적용
|
|
165
|
-
let compilerOptions = options.compilerOptions;
|
|
166
|
-
if (options.compilerOptionsTransformer != null) {
|
|
167
|
-
compilerOptions = options.compilerOptionsTransformer(compilerOptions);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// angularCompilerOptions 병합
|
|
171
|
-
const mergedOptions: ts.CompilerOptions = options.angularCompilerOptions != null
|
|
172
|
-
? { ...compilerOptions, ...(options.angularCompilerOptions as ts.CompilerOptions) }
|
|
173
|
-
: compilerOptions;
|
|
174
|
-
|
|
175
|
-
// 3. ts.createIncrementalCompilerHost 생성
|
|
176
|
-
const host = ts.createIncrementalCompilerHost(mergedOptions);
|
|
177
|
-
|
|
178
|
-
// 4. Angular 호스트 확장 설정
|
|
179
|
-
const hostAny = host as ts.CompilerHost & Record<string, unknown>;
|
|
180
|
-
|
|
181
|
-
hostAny["readResource"] = (fileName: string) => {
|
|
182
|
-
return host.readFile(fileName) ?? "";
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
if (options.transformStylesheet != null) {
|
|
186
|
-
const transformStylesheet = options.transformStylesheet;
|
|
187
|
-
hostAny["transformResource"] = async (
|
|
188
|
-
data: string,
|
|
189
|
-
context: { type: string; containingFile: string; resourceFile: string | null },
|
|
190
|
-
) => {
|
|
191
|
-
if (context.type !== "style") {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
if (data.trim().length === 0) {
|
|
195
|
-
return { content: "" };
|
|
196
|
-
}
|
|
197
|
-
const result = await transformStylesheet(
|
|
198
|
-
data,
|
|
199
|
-
context.containingFile,
|
|
200
|
-
context.resourceFile ?? undefined,
|
|
201
|
-
);
|
|
202
|
-
return typeof result === "string" ? { content: result } : null;
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (sourceFileCache != null) {
|
|
207
|
-
hostAny["getModifiedResourceFiles"] = () => sourceFileCache.modifiedFiles;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
hostAny["resourceNameToFileName"] = (
|
|
211
|
-
resourceName: string,
|
|
212
|
-
containingFile: string,
|
|
213
|
-
): string | null => {
|
|
214
|
-
const resolvedPath = path.join(path.dirname(containingFile), resourceName);
|
|
215
|
-
if (!host.fileExists(resolvedPath)) {
|
|
216
|
-
return null;
|
|
217
|
-
}
|
|
218
|
-
if (options.externalStylesheets == null || hasTemplateExtension(resolvedPath)) {
|
|
219
|
-
return resolvedPath;
|
|
220
|
-
}
|
|
221
|
-
// externalStylesheets를 사용한 스타일시트 처리 (클라이언트 모드)
|
|
222
|
-
let externalId = options.externalStylesheets.get(resolvedPath);
|
|
223
|
-
if (externalId === undefined) {
|
|
224
|
-
externalId = createHash("sha256").update(resolvedPath).digest("hex");
|
|
225
|
-
options.externalStylesheets.set(resolvedPath, externalId);
|
|
226
|
-
}
|
|
227
|
-
return externalId + ".css";
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
// 5. 모듈 해석 캐시 생성
|
|
231
|
-
const moduleResolutionCache = ts.createModuleResolutionCache(
|
|
232
|
-
host.getCurrentDirectory(),
|
|
233
|
-
host.getCanonicalFileName.bind(host),
|
|
234
|
-
mergedOptions,
|
|
235
|
-
this._packageJsonCache,
|
|
236
|
-
);
|
|
237
|
-
host.getModuleResolutionCache = () => moduleResolutionCache;
|
|
238
|
-
|
|
239
|
-
// packageJsonCache를 moduleResolutionCache에서 추출하여 재사용
|
|
240
|
-
if (this._packageJsonCache == null) {
|
|
241
|
-
this._packageJsonCache = moduleResolutionCache.getPackageJsonInfoCache();
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// 6. SourceFileCache 통합
|
|
245
|
-
if (sourceFileCache != null) {
|
|
246
|
-
augmentHostWithCaching(host, sourceFileCache);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// 7. NgtscProgram 생성
|
|
250
|
-
logger.debug(`NgtscProgram 생성 중... (rootNames: ${options.rootNames.length}개, incremental: ${this._ngtscProgram != null})`);
|
|
251
|
-
const angularProgram = new NgtscProgram(
|
|
252
|
-
options.rootNames,
|
|
253
|
-
mergedOptions,
|
|
254
|
-
host,
|
|
255
|
-
this._ngtscProgram,
|
|
256
|
-
);
|
|
257
|
-
|
|
258
|
-
// 8. ensureSourceFileVersions
|
|
259
|
-
const tsProgram = angularProgram.getTsProgram();
|
|
260
|
-
ensureSourceFileVersions(tsProgram);
|
|
261
|
-
const programFiles = tsProgram.getSourceFiles();
|
|
262
|
-
logger.debug(`ts.Program 소스 파일: ${programFiles.length}개`);
|
|
263
|
-
|
|
264
|
-
// 9. BuilderProgram 생성 (진단 + affected file 탐지용)
|
|
265
|
-
// .tsbuildinfo에서 이전 상태를 복원하여 프로세스 재시작 후에도 incremental 진단 유지
|
|
266
|
-
let oldBuilderProgram = this._builderProgram;
|
|
267
|
-
if (oldBuilderProgram == null) {
|
|
268
|
-
oldBuilderProgram = ts.readBuilderProgram(mergedOptions, host) ?? undefined;
|
|
269
|
-
}
|
|
270
|
-
const builderProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram(
|
|
271
|
-
tsProgram,
|
|
272
|
-
host,
|
|
273
|
-
oldBuilderProgram,
|
|
274
|
-
);
|
|
275
|
-
|
|
276
|
-
// 10. AOT 분석
|
|
277
|
-
logger.debug("AOT analyzeAsync 시작");
|
|
278
|
-
await angularProgram.compiler.analyzeAsync();
|
|
279
|
-
logger.debug("AOT analyzeAsync 완료");
|
|
280
|
-
|
|
281
|
-
// 11. findAffectedFiles (내부에서 리소스 의존성 기반 diagnosticCache 무효화도 수행)
|
|
282
|
-
const affectedFiles = this._findAffectedFiles(
|
|
283
|
-
builderProgram,
|
|
284
|
-
angularProgram.compiler,
|
|
285
|
-
sourceFileCache,
|
|
286
|
-
);
|
|
287
|
-
|
|
288
|
-
// 13. 상태 저장
|
|
289
|
-
this._ngtscProgram = angularProgram;
|
|
290
|
-
this._builderProgram = builderProgram;
|
|
291
|
-
this._host = host;
|
|
292
|
-
this._affectedFiles = affectedFiles;
|
|
293
|
-
|
|
294
|
-
logger.debug(`initialize 완료 (affected: ${affectedFiles.size}개)`);
|
|
295
|
-
return { affectedFiles };
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
private _findAffectedFiles(
|
|
299
|
-
builderProgram: ts.EmitAndSemanticDiagnosticsBuilderProgram,
|
|
300
|
-
angularCompiler: NgCompiler,
|
|
301
|
-
sourceFileCache?: AngularSourceFileCache,
|
|
302
|
-
): Set<ts.SourceFile> {
|
|
303
|
-
logger.debug("affected 파일 탐색 시작");
|
|
304
|
-
const affectedFiles = new Set<ts.SourceFile>();
|
|
305
|
-
|
|
306
|
-
while (true) {
|
|
307
|
-
// TypeScript 5.9 + NgtscProgram: getSemanticDiagnosticsOfNextAffectedFile가
|
|
308
|
-
// referencedFiles 인덱스 불일치로 크래시할 수 있음 (fixture 등 비표준 rootNames 포함 시)
|
|
309
|
-
let result: ReturnType<typeof builderProgram.getSemanticDiagnosticsOfNextAffectedFile>;
|
|
310
|
-
try {
|
|
311
|
-
result = builderProgram.getSemanticDiagnosticsOfNextAffectedFile(
|
|
312
|
-
undefined,
|
|
313
|
-
(sourceFile) => {
|
|
314
|
-
if (
|
|
315
|
-
angularCompiler.ignoreForDiagnostics.has(sourceFile) &&
|
|
316
|
-
sourceFile.fileName.endsWith(".ngtypecheck.ts")
|
|
317
|
-
) {
|
|
318
|
-
const originalFilename = sourceFile.fileName.slice(0, -15) + ".ts";
|
|
319
|
-
const originalSourceFile = builderProgram.getSourceFile(originalFilename);
|
|
320
|
-
if (originalSourceFile) {
|
|
321
|
-
affectedFiles.add(originalSourceFile);
|
|
322
|
-
}
|
|
323
|
-
return true;
|
|
324
|
-
}
|
|
325
|
-
return false;
|
|
326
|
-
},
|
|
327
|
-
);
|
|
328
|
-
} catch {
|
|
329
|
-
logger.debug("getSemanticDiagnosticsOfNextAffectedFile 크래시 (무시) — 모든 소스를 affected로 처리");
|
|
330
|
-
for (const sourceFile of builderProgram.getSourceFiles()) {
|
|
331
|
-
if (!angularCompiler.ignoreForDiagnostics.has(sourceFile)) {
|
|
332
|
-
affectedFiles.add(sourceFile);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
break;
|
|
336
|
-
}
|
|
337
|
-
if (!result) {
|
|
338
|
-
break;
|
|
339
|
-
}
|
|
340
|
-
if ("fileName" in result.affected) {
|
|
341
|
-
// ts.SourceFile — 단일 파일 변경
|
|
342
|
-
affectedFiles.add(result.affected);
|
|
343
|
-
} else {
|
|
344
|
-
// ts.Program — 전역 스코프 변경, 모든 소스 파일을 affected로 처리
|
|
345
|
-
for (const sourceFile of builderProgram.getSourceFiles()) {
|
|
346
|
-
if (!angularCompiler.ignoreForDiagnostics.has(sourceFile)) {
|
|
347
|
-
affectedFiles.add(sourceFile);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
// 리소스 의존성 기반 diagnosticCache 무효화
|
|
354
|
-
if (sourceFileCache != null && sourceFileCache.modifiedFiles.size > 0) {
|
|
355
|
-
// modifiedFiles의 경로를 정규화한 Set 생성 (Windows backslash 대응)
|
|
356
|
-
const normalizedModifiedFiles = new Set<string>();
|
|
357
|
-
for (const f of sourceFileCache.modifiedFiles) {
|
|
358
|
-
normalizedModifiedFiles.add(pathx.posix(f));
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
for (const sourceFile of builderProgram.getSourceFiles()) {
|
|
362
|
-
if (angularCompiler.ignoreForEmit.has(sourceFile)) {
|
|
363
|
-
continue;
|
|
364
|
-
}
|
|
365
|
-
const resourceDependencies = angularCompiler.getResourceDependencies(sourceFile);
|
|
366
|
-
for (const resourceDep of resourceDependencies) {
|
|
367
|
-
if (normalizedModifiedFiles.has(pathx.posix(resourceDep))) {
|
|
368
|
-
this._diagnosticCache.delete(sourceFile);
|
|
369
|
-
affectedFiles.add(sourceFile);
|
|
370
|
-
break;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
logger.debug(`affected 파일 탐색 완료 (${affectedFiles.size}개)`);
|
|
377
|
-
return affectedFiles;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
async update(
|
|
381
|
-
modifiedFiles: Iterable<string>,
|
|
382
|
-
): Promise<{
|
|
383
|
-
affectedFiles: ReadonlySet<ts.SourceFile>;
|
|
384
|
-
}> {
|
|
385
|
-
logger.debug("증분 업데이트 시작");
|
|
386
|
-
const sourceFileCache = this._options.sourceFileCache;
|
|
387
|
-
if (sourceFileCache == null) {
|
|
388
|
-
throw new Error("sourceFileCache가 없으면 incremental rebuild를 수행할 수 없습니다");
|
|
389
|
-
}
|
|
390
|
-
sourceFileCache.invalidate(modifiedFiles);
|
|
391
|
-
return this.initialize();
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
*emitAffectedFiles(options?: EmitOptions): Iterable<EmitResult> {
|
|
395
|
-
if (this._ngtscProgram == null || this._builderProgram == null) {
|
|
396
|
-
throw new Error("initialize()를 먼저 호출해야 합니다");
|
|
397
|
-
}
|
|
398
|
-
logger.debug("emitAffectedFiles 시작");
|
|
399
|
-
|
|
400
|
-
const compilerOptions = this._builderProgram.getCompilerOptions();
|
|
401
|
-
|
|
402
|
-
// 1. noEmit=true이면 즉시 return
|
|
403
|
-
if (compilerOptions.noEmit) {
|
|
404
|
-
return;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
const angularCompiler = this._ngtscProgram.compiler;
|
|
408
|
-
const tsProgram = this._ngtscProgram.getTsProgram();
|
|
409
|
-
const affectedFiles = this._affectedFiles;
|
|
410
|
-
|
|
411
|
-
// 2. prepareEmit() → Angular transformers 획득
|
|
412
|
-
const transformers = angularCompiler.prepareEmit().transformers;
|
|
413
|
-
transformers.before ??= [];
|
|
414
|
-
transformers.after ??= [];
|
|
415
|
-
|
|
416
|
-
// 3. additionalTransformers 병합
|
|
417
|
-
if (options?.additionalTransformers != null) {
|
|
418
|
-
if (options.additionalTransformers.before != null) {
|
|
419
|
-
transformers.before.push(...options.additionalTransformers.before);
|
|
420
|
-
}
|
|
421
|
-
if (options.additionalTransformers.after != null) {
|
|
422
|
-
transformers.after.push(...options.additionalTransformers.after);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
// 4. emit 결과를 수집하는 구조
|
|
427
|
-
const emitResults: EmitResult[] = [];
|
|
428
|
-
const emitDeclarationOnly = !!compilerOptions.emitDeclarationOnly;
|
|
429
|
-
|
|
430
|
-
const writeFileCallback: ts.WriteFileCallback = (
|
|
431
|
-
filename,
|
|
432
|
-
contents,
|
|
433
|
-
_writeByteOrderMark,
|
|
434
|
-
_onError,
|
|
435
|
-
sourceFiles,
|
|
436
|
-
) => {
|
|
437
|
-
if (sourceFiles == null || sourceFiles.length === 0) {
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
|
-
const sourceFile = ts.getOriginalNode(sourceFiles[0], ts.isSourceFile);
|
|
441
|
-
if (angularCompiler.ignoreForEmit.has(sourceFile)) {
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
angularCompiler.incrementalCompilation.recordSuccessfulEmit(sourceFile);
|
|
445
|
-
emitResults.push({ filename, contents, sourceFileName: sourceFile.fileName });
|
|
446
|
-
};
|
|
447
|
-
|
|
448
|
-
// 5. ts.Program.emit()으로 직접 emit (NgtscProgram.emit 패턴)
|
|
449
|
-
// EmitAndSemanticDiagnosticsBuilderProgram.emitNextAffectedFile()은 내부적으로
|
|
450
|
-
// emitKind를 DTS-only로 결정할 수 있어 Angular before transformer가 .js를 생성하지 않고
|
|
451
|
-
// DtsTransformRegistry에 메타데이터를 등록하지 않는 문제가 있다.
|
|
452
|
-
// ts.Program.emit()을 직접 호출하면 항상 full emit이 수행된다.
|
|
453
|
-
for (const sourceFile of tsProgram.getSourceFiles()) {
|
|
454
|
-
if (angularCompiler.ignoreForEmit.has(sourceFile)) {
|
|
455
|
-
continue;
|
|
456
|
-
}
|
|
457
|
-
if (sourceFile.isDeclarationFile) {
|
|
458
|
-
continue;
|
|
459
|
-
}
|
|
460
|
-
if (
|
|
461
|
-
angularCompiler.incrementalCompilation.safeToSkipEmit(sourceFile) &&
|
|
462
|
-
!affectedFiles.has(sourceFile)
|
|
463
|
-
) {
|
|
464
|
-
continue;
|
|
465
|
-
}
|
|
466
|
-
tsProgram.emit(
|
|
467
|
-
sourceFile,
|
|
468
|
-
writeFileCallback,
|
|
469
|
-
undefined,
|
|
470
|
-
emitDeclarationOnly,
|
|
471
|
-
transformers,
|
|
472
|
-
);
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
// 6. .tsbuildinfo 영속화 (프로세스 재시작 후 incremental 진단 유지)
|
|
476
|
-
// TS 5.9에서 emitBuildInfo()가 제거됨. emit()이 내부적으로 build info를 기록한다.
|
|
477
|
-
// no-op writeFile로 JS/DTS 재출력 없이 build info만 갱신.
|
|
478
|
-
// TypeScript 5.9 + NgtscProgram: emit가 내부적으로 진단 수집을 트리거하여
|
|
479
|
-
// referencedFiles 인덱스 불일치로 크래시할 수 있음
|
|
480
|
-
// TypeScript 5.9 + NgtscProgram: emit가 내부적으로 진단 수집을 트리거하여
|
|
481
|
-
// referencedFiles 인덱스 불일치로 크래시할 수 있음
|
|
482
|
-
try {
|
|
483
|
-
this._builderProgram.emit(undefined, () => {});
|
|
484
|
-
} catch {
|
|
485
|
-
logger.debug("builderProgram.emit 크래시 (무시) — tsbuildinfo 영속화 생략");
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
// 7. sourceFilter 적용 후 yield
|
|
489
|
-
logger.debug(`emitAffectedFiles 완료 (${emitResults.length}개 파일)`);
|
|
490
|
-
for (const result of emitResults) {
|
|
491
|
-
if (options?.sourceFilter != null && !options.sourceFilter(result.sourceFileName)) {
|
|
492
|
-
continue;
|
|
493
|
-
}
|
|
494
|
-
yield result;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
*collectDiagnostics(): Iterable<ts.Diagnostic> {
|
|
499
|
-
if (this._ngtscProgram == null || this._builderProgram == null) {
|
|
500
|
-
throw new Error("initialize()를 먼저 호출해야 합니다");
|
|
501
|
-
}
|
|
502
|
-
logger.debug("진단 수집 시작");
|
|
503
|
-
|
|
504
|
-
const angularCompiler = this._ngtscProgram.compiler;
|
|
505
|
-
const builderProgram = this._builderProgram;
|
|
506
|
-
const affectedFiles = this._affectedFiles;
|
|
507
|
-
const diagnosticCache = this._diagnosticCache;
|
|
508
|
-
const optimization =
|
|
509
|
-
affectedFiles.size === 1 ? OptimizeFor.SingleFile : OptimizeFor.WholeProgram;
|
|
510
|
-
|
|
511
|
-
// 1. Option 진단
|
|
512
|
-
const configDiags = builderProgram.getConfigFileParsingDiagnostics();
|
|
513
|
-
const ngOptionDiags = angularCompiler.getOptionDiagnostics();
|
|
514
|
-
const tsOptionDiags = builderProgram.getOptionsDiagnostics();
|
|
515
|
-
if (configDiags.length > 0 || ngOptionDiags.length > 0 || tsOptionDiags.length > 0) {
|
|
516
|
-
logger.debug(`옵션 진단: config=${configDiags.length}, ngOption=${ngOptionDiags.length}, tsOption=${tsOptionDiags.length}`);
|
|
517
|
-
}
|
|
518
|
-
yield* configDiags;
|
|
519
|
-
yield* ngOptionDiags;
|
|
520
|
-
yield* tsOptionDiags;
|
|
521
|
-
|
|
522
|
-
// 2. Global
|
|
523
|
-
yield* builderProgram.getGlobalDiagnostics();
|
|
524
|
-
|
|
525
|
-
// 3. 파일별 루프
|
|
526
|
-
for (const sourceFile of builderProgram.getSourceFiles()) {
|
|
527
|
-
if (angularCompiler.ignoreForDiagnostics.has(sourceFile)) {
|
|
528
|
-
continue;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
yield* builderProgram.getSyntacticDiagnostics(sourceFile);
|
|
532
|
-
// TypeScript 5.9 + NgtscProgram: getSemanticDiagnostics가 내부적으로
|
|
533
|
-
// referencedFiles 인덱스 불일치로 크래시할 수 있음 (fixture 파일 포함 시)
|
|
534
|
-
let semanticDiags: readonly ts.Diagnostic[];
|
|
535
|
-
try {
|
|
536
|
-
semanticDiags = builderProgram.getSemanticDiagnostics(sourceFile);
|
|
537
|
-
} catch {
|
|
538
|
-
logger.debug(`getSemanticDiagnostics 크래시 (무시): ${sourceFile.fileName}`);
|
|
539
|
-
semanticDiags = [];
|
|
540
|
-
}
|
|
541
|
-
yield* semanticDiags;
|
|
542
|
-
|
|
543
|
-
// Declaration files는 Angular 진단 없음
|
|
544
|
-
if (sourceFile.isDeclarationFile) {
|
|
545
|
-
continue;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
// Angular 템플릿 진단
|
|
549
|
-
if (affectedFiles.has(sourceFile)) {
|
|
550
|
-
const angularDiagnostics = angularCompiler.getDiagnosticsForFile(
|
|
551
|
-
sourceFile,
|
|
552
|
-
optimization,
|
|
553
|
-
);
|
|
554
|
-
diagnosticCache.set(sourceFile, angularDiagnostics);
|
|
555
|
-
yield* angularDiagnostics;
|
|
556
|
-
} else {
|
|
557
|
-
const cached = diagnosticCache.get(sourceFile);
|
|
558
|
-
if (cached) {
|
|
559
|
-
yield* cached;
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
}
|