@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NgtscEngine.d.ts","sourceRoot":"","sources":["../../src/engines/NgtscEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"NgtscEngine.d.ts","sourceRoot":"","sources":["../../src/engines/NgtscEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,wBAAwB,MAAM,iCAAiC,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAKxE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,gBAAgB,CAAC;IACtB,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,oCAAoC;IACpC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,kCAAkC;IAClC,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,UAAU,CACzC,gBAAgB,EAChB,OAAO,wBAAwB,GAAG,uBAAuB,CAC1D;gBACa,OAAO,EAAE,kBAAkB;IAIvC,SAAS,CAAC,cAAc,IAAI,MAAM;IAIlC,SAAS,CAAC,UAAU,IAAI,MAAM;cAId,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;cAYtD,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAUpE"}
|
|
@@ -4,15 +4,15 @@ const logger = consola.withTag("sd:cli:engine:ngtsc");
|
|
|
4
4
|
/**
|
|
5
5
|
* NgtscProgram 기반 Angular 라이브러리 패키지용 빌드 엔진
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* 통합된 library-build.worker를 사용하며, globalScss: true를 전달하여
|
|
8
|
+
* Angular AOT 컴파일 + SCSS 빌드를 활성화한다.
|
|
9
9
|
*/
|
|
10
10
|
export class NgtscEngine extends BaseEngine {
|
|
11
11
|
constructor(options) {
|
|
12
12
|
super(options);
|
|
13
13
|
}
|
|
14
14
|
_getWorkerPath() {
|
|
15
|
-
return import.meta.resolve("../workers/
|
|
15
|
+
return import.meta.resolve("../workers/library-build.worker");
|
|
16
16
|
}
|
|
17
17
|
_getTarget() {
|
|
18
18
|
return this._pkg.config.target;
|
|
@@ -23,7 +23,7 @@ export class NgtscEngine extends BaseEngine {
|
|
|
23
23
|
name: this._pkg.name,
|
|
24
24
|
cwd: this._cwd,
|
|
25
25
|
pkgDir: this._pkg.dir,
|
|
26
|
-
output,
|
|
26
|
+
output: { ...output, globalScss: true },
|
|
27
27
|
});
|
|
28
28
|
return this._normalizeResult(result);
|
|
29
29
|
}
|
|
@@ -33,7 +33,7 @@ export class NgtscEngine extends BaseEngine {
|
|
|
33
33
|
name: this._pkg.name,
|
|
34
34
|
cwd: this._cwd,
|
|
35
35
|
pkgDir: this._pkg.dir,
|
|
36
|
-
output,
|
|
36
|
+
output: { ...output, globalScss: true },
|
|
37
37
|
replaceDeps: this._replaceDeps,
|
|
38
38
|
});
|
|
39
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NgtscEngine.js","sourceRoot":"","sources":["../../src/engines/NgtscEngine.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAgC,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAgBtD;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,UAGhC;IACC,YAAY,OAA2B;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAES,cAAc;QACtB,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"NgtscEngine.js","sourceRoot":"","sources":["../../src/engines/NgtscEngine.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAgC,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAgBtD;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,UAGhC;IACC,YAAY,OAA2B;QAC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E,OAAO,EAAE,UAAU,EAAE,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAKxE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,gBAAgB,CAAC;IACtB,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,oCAAoC;IACpC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,kCAAkC;IAClC,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,UAAU,CACvC,gBAAgB,EAChB,OAAO,wBAAwB,GAAG,uBAAuB,CAC1D;gBACa,OAAO,EAAE,gBAAgB;IAIrC,SAAS,CAAC,cAAc,IAAI,MAAM;IAIlC,SAAS,CAAC,UAAU,IAAI,MAAM;cAId,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;cAYtD,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAUpE"}
|
|
@@ -21,7 +21,6 @@ export class TscEngine extends BaseEngine {
|
|
|
21
21
|
logger.debug(`[${this._pkg.name}] worker.build 호출`);
|
|
22
22
|
const result = await this._worker.build({
|
|
23
23
|
name: this._pkg.name,
|
|
24
|
-
config: this._pkg.config,
|
|
25
24
|
cwd: this._cwd,
|
|
26
25
|
pkgDir: this._pkg.dir,
|
|
27
26
|
output,
|
|
@@ -32,7 +31,6 @@ export class TscEngine extends BaseEngine {
|
|
|
32
31
|
logger.debug(`[${this._pkg.name}] worker.startWatch 호출`);
|
|
33
32
|
await this._worker.startWatch({
|
|
34
33
|
name: this._pkg.name,
|
|
35
|
-
config: this._pkg.config,
|
|
36
34
|
cwd: this._cwd,
|
|
37
35
|
pkgDir: this._pkg.dir,
|
|
38
36
|
output,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TscEngine.js","sourceRoot":"","sources":["../../src/engines/TscEngine.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAgC,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAgBpD;;;;;GAKG;AACH,MAAM,OAAO,SAAU,SAAQ,UAG9B;IACC,YAAY,OAAyB;QACnC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAES,cAAc;QACtB,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAC;IAChE,CAAC;IAES,UAAU;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IACjC,CAAC;IAES,KAAK,CAAC,UAAU,CAAC,MAAmB;QAC5C,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,CAAC;QACpD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAQ,CAAC,KAAK,CAAC;YACvC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;YACpB,
|
|
1
|
+
{"version":3,"file":"TscEngine.js","sourceRoot":"","sources":["../../src/engines/TscEngine.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAgC,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAgBpD;;;;;GAKG;AACH,MAAM,OAAO,SAAU,SAAQ,UAG9B;IACC,YAAY,OAAyB;QACnC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAES,cAAc;QACtB,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAC;IAChE,CA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
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import type esbuild from "esbuild";
|
|
3
|
+
import type { AngularSourceFileCache } from "../angular/angular-compiler.js";
|
|
4
|
+
import type { SerializedDiagnostic } from "../typecheck/typecheck-serialization.js";
|
|
5
|
+
import { type LoadResultCache } from "./load-result-cache.js";
|
|
6
|
+
export interface AngularCompilerPluginOptions {
|
|
7
|
+
tsconfig: string;
|
|
8
|
+
sourcemap: boolean;
|
|
9
|
+
advancedOptimizations: boolean;
|
|
10
|
+
thirdPartySourcemaps: boolean;
|
|
11
|
+
incremental: boolean;
|
|
12
|
+
includeTestMetadata?: boolean;
|
|
13
|
+
templateUpdates?: Map<string, string>;
|
|
14
|
+
sourceFileCache?: AngularSourceFileCache;
|
|
15
|
+
typeScriptFileCache?: Map<string, string | Uint8Array>;
|
|
16
|
+
loadResultCache?: LoadResultCache;
|
|
17
|
+
persistentCachePath?: string;
|
|
18
|
+
transformStylesheet?: (data: string, containingFile: string, stylesheetFile?: string) => Promise<string | null>;
|
|
19
|
+
externalStylesheets?: Map<string, string>;
|
|
20
|
+
/** SCSS 의존성 Map (transformStylesheet가 기록, Plugin이 FileReferenceTracker에 등록) */
|
|
21
|
+
stylesheetDependencies?: Map<string, Set<string>>;
|
|
22
|
+
/** SCSS 에러 배열 (transformStylesheet가 기록, Plugin이 esbuild errors로 변환) */
|
|
23
|
+
stylesheetErrors?: string[];
|
|
24
|
+
}
|
|
25
|
+
export declare function createCompilerOptionsTransformer(options: AngularCompilerPluginOptions, preserveSymlinks: boolean | undefined): (compilerOptions: ts.CompilerOptions) => ts.CompilerOptions;
|
|
26
|
+
export declare function convertDiagnostic(diagnostic: ts.Diagnostic, cwd: string): esbuild.PartialMessage;
|
|
27
|
+
export declare function convertSerializedDiagnosticToEsbuild(d: SerializedDiagnostic, program: ts.Program, cwd: string): esbuild.PartialMessage;
|
|
28
|
+
/**
|
|
29
|
+
* Worker 파일을 esbuild.buildSync()로 별도 ESM 번들로 빌드한다.
|
|
30
|
+
* TypeScript transformer 내에서 동기적으로 호출되므로 sync API를 사용한다.
|
|
31
|
+
*/
|
|
32
|
+
export declare function bundleWebWorker(build: esbuild.PluginBuild, sourcemap: boolean, workerFile: string): esbuild.BuildResult;
|
|
33
|
+
export declare function requiresAngularCompiler(contents: string): boolean;
|
|
34
|
+
export declare function createMissingFileDiagnostic(request: string, original: string, root: string, angular: boolean): esbuild.PartialMessage;
|
|
35
|
+
export declare function createAngularCompilerPlugin(pluginOptions: AngularCompilerPluginOptions): esbuild.Plugin;
|
|
36
|
+
//# sourceMappingURL=esbuild-angular-compiler-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esbuild-angular-compiler-plugin.d.ts","sourceRoot":"","sources":["../../src/esbuild/esbuild-angular-compiler-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAKpF,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAQhF,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEtC,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC;IACvD,eAAe,CA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CA6BxB;AAMD,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,4BAA4B,GAC1C,OAAO,CAAC,MAAM,CAyYhB"}
|
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import os from "os";
|
|
4
|
+
import ts from "typescript";
|
|
5
|
+
import { consola } from "consola";
|
|
6
|
+
import { JavaScriptTransformer, Cache as AngularCache } from "@angular/build/private";
|
|
7
|
+
import { SdTsCompiler } from "../ts-compiler/SdTsCompiler.js";
|
|
8
|
+
import { FileReferenceTracker } from "./file-reference-tracker.js";
|
|
9
|
+
import { LmdbCacheStore } from "./lmdb-cache-store.js";
|
|
10
|
+
import { createCachedLoad } from "./load-result-cache.js";
|
|
11
|
+
import { collectHmrCandidates, HMR_MODIFIED_FILE_LIMIT } from "../angular/hmr-candidates.js";
|
|
12
|
+
import { createWorkerTransformer } from "../angular/web-worker-transformer.js";
|
|
13
|
+
const logger = consola.withTag("sd:cli:angular-plugin");
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region compilerOptions 변환
|
|
16
|
+
export function createCompilerOptionsTransformer(options, preserveSymlinks) {
|
|
17
|
+
return (compilerOptions) => {
|
|
18
|
+
// target < ES2022이면 강제 ES2022
|
|
19
|
+
if (compilerOptions.target == null || compilerOptions.target < ts.ScriptTarget.ES2022) {
|
|
20
|
+
compilerOptions.target = ts.ScriptTarget.ES2022;
|
|
21
|
+
compilerOptions.useDefineForClassFields ??= false;
|
|
22
|
+
}
|
|
23
|
+
// module < ES2015이면 강제 ES2022
|
|
24
|
+
if (compilerOptions.module == null || compilerOptions.module < ts.ModuleKind.ES2015) {
|
|
25
|
+
compilerOptions.module = ts.ModuleKind.ES2022;
|
|
26
|
+
}
|
|
27
|
+
// compilationMode: partial → full
|
|
28
|
+
if (compilerOptions["compilationMode"] === "partial") {
|
|
29
|
+
compilerOptions["compilationMode"] = "full";
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
...compilerOptions,
|
|
33
|
+
noEmitOnError: false,
|
|
34
|
+
composite: false,
|
|
35
|
+
declaration: false,
|
|
36
|
+
declarationMap: false,
|
|
37
|
+
inlineSources: !!options.sourcemap,
|
|
38
|
+
inlineSourceMap: !!options.sourcemap,
|
|
39
|
+
sourceMap: undefined,
|
|
40
|
+
mapRoot: undefined,
|
|
41
|
+
sourceRoot: undefined,
|
|
42
|
+
preserveSymlinks,
|
|
43
|
+
incremental: options.persistentCachePath != null,
|
|
44
|
+
tsBuildInfoFile: options.persistentCachePath != null
|
|
45
|
+
? path.join(options.persistentCachePath, ".tsbuildinfo")
|
|
46
|
+
: undefined,
|
|
47
|
+
_enableHmr: !!options.templateUpdates,
|
|
48
|
+
supportTestBed: !!options.includeTestMetadata,
|
|
49
|
+
supportJitMode: !!options.includeTestMetadata,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region diagnostics 변환
|
|
55
|
+
export function convertDiagnostic(diagnostic, cwd) {
|
|
56
|
+
const text = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
57
|
+
let location = null;
|
|
58
|
+
if (diagnostic.file != null && diagnostic.start != null) {
|
|
59
|
+
const pos = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
60
|
+
const lineStart = diagnostic.file.getLineStarts()[pos.line];
|
|
61
|
+
const lineEnd = diagnostic.file.getLineStarts()[pos.line + 1] ?? diagnostic.file.text.length;
|
|
62
|
+
const lineText = diagnostic.file.text.slice(lineStart, lineEnd).replace(/\r?\n$/, "");
|
|
63
|
+
location = {
|
|
64
|
+
file: path.relative(cwd, diagnostic.file.fileName),
|
|
65
|
+
line: pos.line + 1,
|
|
66
|
+
column: pos.character,
|
|
67
|
+
lineText,
|
|
68
|
+
length: diagnostic.length ?? 0,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return { text, location };
|
|
72
|
+
}
|
|
73
|
+
export function convertSerializedDiagnosticToEsbuild(d, program, cwd) {
|
|
74
|
+
let location = null;
|
|
75
|
+
if (d.file != null && d.start != null) {
|
|
76
|
+
const sf = program.getSourceFile(d.file.fileName);
|
|
77
|
+
if (sf != null) {
|
|
78
|
+
const pos = sf.getLineAndCharacterOfPosition(d.start);
|
|
79
|
+
const lineStart = sf.getLineStarts()[pos.line];
|
|
80
|
+
const lineEnd = sf.getLineStarts()[pos.line + 1] ?? sf.text.length;
|
|
81
|
+
const lineText = sf.text.slice(lineStart, lineEnd).replace(/\r?\n$/, "");
|
|
82
|
+
location = {
|
|
83
|
+
file: path.relative(cwd, d.file.fileName),
|
|
84
|
+
line: pos.line + 1,
|
|
85
|
+
column: pos.character,
|
|
86
|
+
lineText,
|
|
87
|
+
length: d.length ?? 0,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return { text: d.messageText, location };
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region bundleWebWorker
|
|
95
|
+
/**
|
|
96
|
+
* Worker 파일을 esbuild.buildSync()로 별도 ESM 번들로 빌드한다.
|
|
97
|
+
* TypeScript transformer 내에서 동기적으로 호출되므로 sync API를 사용한다.
|
|
98
|
+
*/
|
|
99
|
+
export function bundleWebWorker(build, sourcemap, workerFile) {
|
|
100
|
+
try {
|
|
101
|
+
return build.esbuild.buildSync({
|
|
102
|
+
...build.initialOptions,
|
|
103
|
+
platform: "browser",
|
|
104
|
+
write: false,
|
|
105
|
+
bundle: true,
|
|
106
|
+
metafile: true,
|
|
107
|
+
format: "esm",
|
|
108
|
+
entryNames: "worker-[hash]",
|
|
109
|
+
entryPoints: [workerFile],
|
|
110
|
+
sourcemap,
|
|
111
|
+
supported: undefined,
|
|
112
|
+
plugins: undefined,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
if (error != null &&
|
|
117
|
+
typeof error === "object" &&
|
|
118
|
+
"errors" in error &&
|
|
119
|
+
"warnings" in error) {
|
|
120
|
+
return error;
|
|
121
|
+
}
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region onLoad 헬퍼
|
|
127
|
+
const POTENTIAL_METADATA_REGEX = /@angular\/core|@Component|@Directive|@Injectable|@Pipe|@NgModule/;
|
|
128
|
+
export function requiresAngularCompiler(contents) {
|
|
129
|
+
return POTENTIAL_METADATA_REGEX.test(contents);
|
|
130
|
+
}
|
|
131
|
+
export function createMissingFileDiagnostic(request, original, root, angular) {
|
|
132
|
+
const relativeRequest = path.relative(root, request);
|
|
133
|
+
const notes = [];
|
|
134
|
+
if (angular) {
|
|
135
|
+
notes.push({
|
|
136
|
+
text: "Files containing Angular metadata ('@Component'/'@Directive'/etc.) must be part of the TypeScript compilation." +
|
|
137
|
+
" You can ensure the file is part of the TypeScript program via the 'files' or 'include' property.",
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
notes.push({
|
|
142
|
+
text: "The file will be bundled and included in the output but will not be type-checked at build time." +
|
|
143
|
+
" To remove this message you can add the file to the TypeScript program via the 'files' or 'include' property.",
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const relativeOriginal = path.relative(root, original);
|
|
147
|
+
if (relativeRequest !== relativeOriginal) {
|
|
148
|
+
notes.push({
|
|
149
|
+
text: `File is requested from a file replacement of '${relativeOriginal}'.`,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
text: `File '${relativeRequest}' not found in TypeScript compilation.`,
|
|
154
|
+
notes,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region Plugin 팩토리
|
|
159
|
+
export function createAngularCompilerPlugin(pluginOptions) {
|
|
160
|
+
return {
|
|
161
|
+
name: "sd-angular-compiler",
|
|
162
|
+
setup(build) {
|
|
163
|
+
const preserveSymlinks = build.initialOptions.preserveSymlinks;
|
|
164
|
+
const cwd = build.initialOptions.absWorkingDir ?? process.cwd();
|
|
165
|
+
// ── define 주입 ──
|
|
166
|
+
build.initialOptions.define ??= {};
|
|
167
|
+
build.initialOptions.define["ngI18nClosureMode"] ??= "false";
|
|
168
|
+
// ── LMDB 캐시 초기화 ──
|
|
169
|
+
let cacheStore;
|
|
170
|
+
if (pluginOptions.persistentCachePath != null) {
|
|
171
|
+
try {
|
|
172
|
+
cacheStore = new LmdbCacheStore(path.join(pluginOptions.persistentCachePath, "angular-compiler.db"));
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
logger.warn("LMDB 캐시 초기화 실패:", e instanceof Error ? e.message : String(e));
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// ── JavaScriptTransformer 초기화 ──
|
|
179
|
+
const maxWorkers = Math.max(Math.floor((os.cpus().length * 7) / 8), 1);
|
|
180
|
+
const javascriptTransformer = new JavaScriptTransformer({
|
|
181
|
+
sourcemap: !!pluginOptions.sourcemap,
|
|
182
|
+
thirdPartySourcemaps: pluginOptions.thirdPartySourcemaps,
|
|
183
|
+
advancedOptimizations: pluginOptions.advancedOptimizations,
|
|
184
|
+
jit: pluginOptions.includeTestMetadata === true,
|
|
185
|
+
}, maxWorkers, cacheStore != null ? new AngularCache(cacheStore, "jstransformer") : undefined);
|
|
186
|
+
// ── 내부 상태 ──
|
|
187
|
+
const typeScriptFileCache = pluginOptions.typeScriptFileCache ?? new Map();
|
|
188
|
+
const additionalResults = new Map();
|
|
189
|
+
const referencedFileTracker = new FileReferenceTracker();
|
|
190
|
+
let sdTsCompiler;
|
|
191
|
+
let lastResult;
|
|
192
|
+
let hasCompilationErrors = true;
|
|
193
|
+
// TS/JS onLoad에서 참조할 플래그 (onStart에서 compilerOptions 기반으로 결정)
|
|
194
|
+
let shouldTsIgnoreJs = true;
|
|
195
|
+
let useTypeScriptTranspilation = true;
|
|
196
|
+
async function hasSideEffects(filePath) {
|
|
197
|
+
if (!pluginOptions.advancedOptimizations) {
|
|
198
|
+
return undefined;
|
|
199
|
+
}
|
|
200
|
+
const { sideEffects } = await build.resolve(filePath, {
|
|
201
|
+
kind: "import-statement",
|
|
202
|
+
resolveDir: cwd,
|
|
203
|
+
});
|
|
204
|
+
return sideEffects;
|
|
205
|
+
}
|
|
206
|
+
// ── 서브함수: WebWorker 프로세서 생성 ──
|
|
207
|
+
function createWebWorkerProcessor(errors, warnings) {
|
|
208
|
+
return (workerFile, containingFile) => {
|
|
209
|
+
const fullWorkerPath = path.join(path.dirname(containingFile), workerFile);
|
|
210
|
+
const workerResult = bundleWebWorker(build, pluginOptions.sourcemap, fullWorkerPath);
|
|
211
|
+
warnings.push(...workerResult.warnings);
|
|
212
|
+
if (workerResult.errors.length > 0) {
|
|
213
|
+
errors.push(...workerResult.errors);
|
|
214
|
+
// 에러 파일 경로 추적 (rebuild 허용)
|
|
215
|
+
referencedFileTracker.add(containingFile, workerResult.errors
|
|
216
|
+
.map((e) => e.location?.file)
|
|
217
|
+
.filter((f) => f != null)
|
|
218
|
+
.map((f) => path.join(cwd, f)));
|
|
219
|
+
additionalResults.set(fullWorkerPath, { errors: workerResult.errors });
|
|
220
|
+
return workerFile;
|
|
221
|
+
}
|
|
222
|
+
additionalResults.set(fullWorkerPath, {
|
|
223
|
+
outputFiles: workerResult.outputFiles,
|
|
224
|
+
metafile: workerResult.metafile,
|
|
225
|
+
});
|
|
226
|
+
// metafile.inputs → FileReferenceTracker
|
|
227
|
+
if (workerResult.metafile != null) {
|
|
228
|
+
referencedFileTracker.add(containingFile, Object.keys(workerResult.metafile.inputs).map((input) => path.join(cwd, input)));
|
|
229
|
+
}
|
|
230
|
+
// worker-[HASH].js 파일 찾기
|
|
231
|
+
const workerCodeFile = workerResult.outputFiles?.find((file) => /^worker-[A-Z0-9]{8}\.[cm]?js$/.test(path.basename(file.path)));
|
|
232
|
+
if (workerCodeFile == null) {
|
|
233
|
+
errors.push({ text: `Web Worker bundled code file not found: ${fullWorkerPath}`, location: null });
|
|
234
|
+
return workerFile;
|
|
235
|
+
}
|
|
236
|
+
const outdir = build.initialOptions.outdir ?? "";
|
|
237
|
+
const workerCodePath = path.relative(outdir, workerCodeFile.path);
|
|
238
|
+
return workerCodePath.replaceAll("\\", "/");
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
// ── onStart ──
|
|
242
|
+
build.onStart(async () => {
|
|
243
|
+
const result = {};
|
|
244
|
+
const errors = [];
|
|
245
|
+
const warnings = [];
|
|
246
|
+
// ── stylesheetErrors 리셋 (stale 에러 방지) ──
|
|
247
|
+
if (pluginOptions.stylesheetErrors != null) {
|
|
248
|
+
pluginOptions.stylesheetErrors.length = 0;
|
|
249
|
+
}
|
|
250
|
+
try {
|
|
251
|
+
const sourceFileCache = pluginOptions.sourceFileCache;
|
|
252
|
+
const isIncremental = sdTsCompiler != null &&
|
|
253
|
+
sourceFileCache != null &&
|
|
254
|
+
sourceFileCache.modifiedFiles.size > 0;
|
|
255
|
+
// ── HMR: staleSourceFiles 캡처 (compileAsync 전에 수행) ──
|
|
256
|
+
let staleSourceFiles;
|
|
257
|
+
let expandedModifiedFiles;
|
|
258
|
+
if (isIncremental) {
|
|
259
|
+
const useHmr = pluginOptions.templateUpdates != null &&
|
|
260
|
+
sourceFileCache.modifiedFiles.size <= HMR_MODIFIED_FILE_LIMIT;
|
|
261
|
+
if (useHmr && lastResult != null) {
|
|
262
|
+
for (const modifiedFile of sourceFileCache.modifiedFiles) {
|
|
263
|
+
const sf = lastResult.program.getSourceFile(modifiedFile);
|
|
264
|
+
if (sf != null) {
|
|
265
|
+
staleSourceFiles ??= new Map();
|
|
266
|
+
staleSourceFiles.set(modifiedFile, sf);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
// referencedFileTracker 확장
|
|
271
|
+
expandedModifiedFiles = referencedFileTracker.update(sourceFileCache.modifiedFiles);
|
|
272
|
+
// stale additionalResults 제거
|
|
273
|
+
for (const file of expandedModifiedFiles) {
|
|
274
|
+
additionalResults.delete(file);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
// ── SdTsCompiler 인스턴스 생성 (첫 빌드 시) ──
|
|
278
|
+
if (sdTsCompiler == null) {
|
|
279
|
+
sdTsCompiler = new SdTsCompiler({
|
|
280
|
+
pkgDir: path.dirname(pluginOptions.tsconfig),
|
|
281
|
+
cwd,
|
|
282
|
+
output: { js: true, dts: false },
|
|
283
|
+
sourceFileCache: pluginOptions.sourceFileCache,
|
|
284
|
+
transformStylesheet: pluginOptions.transformStylesheet,
|
|
285
|
+
externalStylesheets: pluginOptions.externalStylesheets,
|
|
286
|
+
compilerOptionsTransformer: createCompilerOptionsTransformer(pluginOptions, preserveSymlinks),
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
// ── processWebWorker + workerTransformer ──
|
|
290
|
+
const processWebWorker = createWebWorkerProcessor(errors, warnings);
|
|
291
|
+
const workerTransformer = createWorkerTransformer(processWebWorker);
|
|
292
|
+
// ── compileAsync ──
|
|
293
|
+
const compileResult = await sdTsCompiler.compileAsync(isIncremental ? expandedModifiedFiles : undefined, { additionalTransformers: { before: [workerTransformer] } });
|
|
294
|
+
// ── emitResults → typeScriptFileCache ──
|
|
295
|
+
for (const { contents, sourceFileName } of compileResult.emitResults ?? []) {
|
|
296
|
+
typeScriptFileCache.set(path.normalize(sourceFileName), contents);
|
|
297
|
+
}
|
|
298
|
+
// ── onLoad 플래그 결정 (첫 빌드에서만) ──
|
|
299
|
+
if (lastResult == null) {
|
|
300
|
+
const co = compileResult.program.getCompilerOptions();
|
|
301
|
+
shouldTsIgnoreJs = !co.allowJs;
|
|
302
|
+
useTypeScriptTranspilation =
|
|
303
|
+
!co.isolatedModules || !!co.sourceMap || !!co.inlineSourceMap;
|
|
304
|
+
}
|
|
305
|
+
// ── diagnostics → esbuild errors/warnings ──
|
|
306
|
+
for (const d of compileResult.diagnostics) {
|
|
307
|
+
const msg = convertSerializedDiagnosticToEsbuild(d, compileResult.program, cwd);
|
|
308
|
+
if (d.category === ts.DiagnosticCategory.Error) {
|
|
309
|
+
errors.push(msg);
|
|
310
|
+
}
|
|
311
|
+
else if (d.category === ts.DiagnosticCategory.Warning) {
|
|
312
|
+
warnings.push(msg);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
// ── stylesheetDependencies → FileReferenceTracker 브릿징 ──
|
|
316
|
+
if (pluginOptions.stylesheetDependencies != null) {
|
|
317
|
+
for (const [containingFile, deps] of pluginOptions.stylesheetDependencies) {
|
|
318
|
+
referencedFileTracker.add(containingFile, deps);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
// ── stylesheetErrors → esbuild errors 변환 ──
|
|
322
|
+
if (pluginOptions.stylesheetErrors != null) {
|
|
323
|
+
for (const errText of pluginOptions.stylesheetErrors) {
|
|
324
|
+
errors.push({ text: errText, location: null });
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
// ── HMR templateUpdates 수집 (증분 빌드 시) ──
|
|
328
|
+
if (isIncremental &&
|
|
329
|
+
staleSourceFiles != null &&
|
|
330
|
+
compileResult.ngtscProgram != null &&
|
|
331
|
+
pluginOptions.templateUpdates != null) {
|
|
332
|
+
const hmrCandidates = collectHmrCandidates(sourceFileCache.modifiedFiles, compileResult.ngtscProgram, staleSourceFiles);
|
|
333
|
+
if (hmrCandidates.size > 0) {
|
|
334
|
+
const ngCompiler = compileResult.ngtscProgram.compiler;
|
|
335
|
+
for (const node of hmrCandidates) {
|
|
336
|
+
if (!ts.isClassDeclaration(node))
|
|
337
|
+
continue;
|
|
338
|
+
const componentFilename = node.getSourceFile().fileName;
|
|
339
|
+
let relativePath = path.relative(cwd, componentFilename);
|
|
340
|
+
if (relativePath.startsWith("..")) {
|
|
341
|
+
relativePath = componentFilename;
|
|
342
|
+
}
|
|
343
|
+
relativePath = relativePath.replaceAll("\\", "/");
|
|
344
|
+
const updateId = encodeURIComponent(`${relativePath}@${node.name?.text}`);
|
|
345
|
+
const updateText = ngCompiler
|
|
346
|
+
.emitHmrUpdateModule?.(node);
|
|
347
|
+
if (updateText == null) {
|
|
348
|
+
pluginOptions.templateUpdates.clear();
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
pluginOptions.templateUpdates.set(updateId, updateText);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
hasCompilationErrors = errors.length > 0;
|
|
356
|
+
lastResult = compileResult;
|
|
357
|
+
}
|
|
358
|
+
catch (error) {
|
|
359
|
+
hasCompilationErrors = true;
|
|
360
|
+
errors.push({
|
|
361
|
+
text: "Angular compilation failed.",
|
|
362
|
+
location: null,
|
|
363
|
+
notes: [
|
|
364
|
+
{
|
|
365
|
+
text: error instanceof Error ? (error.stack ?? error.message) : `${error}`,
|
|
366
|
+
location: null,
|
|
367
|
+
},
|
|
368
|
+
],
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
if (errors.length > 0)
|
|
372
|
+
result.errors = errors;
|
|
373
|
+
if (warnings.length > 0)
|
|
374
|
+
result.warnings = warnings;
|
|
375
|
+
return result;
|
|
376
|
+
});
|
|
377
|
+
// ── TS onLoad ── (filter: .ts, .tsx, .mts, .cts, .js, .mjs, .cjs, .jsx)
|
|
378
|
+
build.onLoad({ filter: /\.[cm]?[jt]sx?$/ }, async (args) => {
|
|
379
|
+
const request = path.normalize(args.path);
|
|
380
|
+
const isJS = /\.[cm]?js$/.test(request);
|
|
381
|
+
// allowJs 미설정 시 JS 파일은 다음 핸들러에 위임
|
|
382
|
+
if (shouldTsIgnoreJs && isJS) {
|
|
383
|
+
return undefined;
|
|
384
|
+
}
|
|
385
|
+
let contents = typeScriptFileCache.get(request);
|
|
386
|
+
if (contents == null) {
|
|
387
|
+
// 컴파일 에러가 있으면 빈 contents 반환 (연쇄 에러 방지)
|
|
388
|
+
if (hasCompilationErrors) {
|
|
389
|
+
return { contents: "", loader: "js" };
|
|
390
|
+
}
|
|
391
|
+
// allowJs이고 JS 파일이면 다음 핸들러에 위임
|
|
392
|
+
if (!shouldTsIgnoreJs && isJS) {
|
|
393
|
+
return undefined;
|
|
394
|
+
}
|
|
395
|
+
// Angular 데코레이터 여부 검사
|
|
396
|
+
const directContents = await fs.promises.readFile(request, "utf-8");
|
|
397
|
+
if (!requiresAngularCompiler(directContents)) {
|
|
398
|
+
return {
|
|
399
|
+
warnings: [createMissingFileDiagnostic(request, args.path, cwd, false)],
|
|
400
|
+
contents: undefined,
|
|
401
|
+
loader: "ts",
|
|
402
|
+
resolveDir: path.dirname(request),
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
return {
|
|
406
|
+
errors: [createMissingFileDiagnostic(request, args.path, cwd, true)],
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
// string 타입이면 JavaScriptTransformer로 추가 변환
|
|
410
|
+
if (typeof contents === "string" && (useTypeScriptTranspilation || isJS)) {
|
|
411
|
+
const sideEffects = await hasSideEffects(request);
|
|
412
|
+
contents = await javascriptTransformer.transformData(request, contents, true, // skipLinker
|
|
413
|
+
sideEffects);
|
|
414
|
+
// Uint8Array로 재캐싱
|
|
415
|
+
typeScriptFileCache.set(request, contents);
|
|
416
|
+
}
|
|
417
|
+
// loader 결정
|
|
418
|
+
const loader = useTypeScriptTranspilation || isJS
|
|
419
|
+
? "js"
|
|
420
|
+
: request.at(-1) === "x"
|
|
421
|
+
? "tsx"
|
|
422
|
+
: "ts";
|
|
423
|
+
return {
|
|
424
|
+
contents,
|
|
425
|
+
loader,
|
|
426
|
+
resolveDir: path.dirname(request),
|
|
427
|
+
};
|
|
428
|
+
});
|
|
429
|
+
// ── JS onLoad ── (filter: .js, .mjs, .cjs)
|
|
430
|
+
build.onLoad({ filter: /\.[cm]?js$/ }, createCachedLoad(pluginOptions.loadResultCache, async (args) => {
|
|
431
|
+
const request = path.normalize(args.path);
|
|
432
|
+
const sideEffects = await hasSideEffects(request);
|
|
433
|
+
const contents = await javascriptTransformer.transformFile(request, false, // skipLinker
|
|
434
|
+
sideEffects);
|
|
435
|
+
return {
|
|
436
|
+
contents,
|
|
437
|
+
loader: "js",
|
|
438
|
+
resolveDir: path.dirname(request),
|
|
439
|
+
};
|
|
440
|
+
}));
|
|
441
|
+
// ── onEnd ──
|
|
442
|
+
build.onEnd((result) => {
|
|
443
|
+
for (const { outputFiles, metafile } of additionalResults.values()) {
|
|
444
|
+
if (outputFiles != null && outputFiles.length > 0) {
|
|
445
|
+
result.outputFiles?.push(...outputFiles);
|
|
446
|
+
}
|
|
447
|
+
if (result.metafile != null && metafile != null) {
|
|
448
|
+
Object.assign(result.metafile.inputs, metafile.inputs);
|
|
449
|
+
Object.assign(result.metafile.outputs, metafile.outputs);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
// ── onDispose ──
|
|
454
|
+
build.onDispose(() => {
|
|
455
|
+
sdTsCompiler = undefined;
|
|
456
|
+
lastResult = undefined;
|
|
457
|
+
void javascriptTransformer.close();
|
|
458
|
+
void cacheStore?.close();
|
|
459
|
+
});
|
|
460
|
+
},
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
//#endregion
|
|
464
|
+
//# sourceMappingURL=esbuild-angular-compiler-plugin.js.map
|