@simplysm/sd-cli 14.0.30 → 14.0.33
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/{utils → angular}/angular-build-pipeline.d.ts +0 -2
- package/dist/angular/angular-build-pipeline.d.ts.map +1 -0
- package/dist/{utils → angular}/angular-build-pipeline.js +3 -6
- package/dist/angular/angular-build-pipeline.js.map +1 -0
- package/dist/{utils → angular}/angular-build.d.ts +1 -1
- package/dist/angular/angular-build.d.ts.map +1 -0
- package/dist/{utils → angular}/angular-build.js +1 -1
- package/dist/angular/angular-build.js.map +1 -0
- package/dist/{utils → angular}/angular-compiler.d.ts +0 -3
- package/dist/angular/angular-compiler.d.ts.map +1 -0
- package/dist/{utils → angular}/angular-compiler.js +1 -45
- package/dist/angular/angular-compiler.js.map +1 -0
- package/dist/angular/client-transform-stylesheet.js +1 -1
- package/dist/angular/client-transform-stylesheet.js.map +1 -1
- package/dist/{utils → angular}/ngtsc-build-core.d.ts +3 -3
- package/dist/angular/ngtsc-build-core.d.ts.map +1 -0
- package/dist/angular/ngtsc-build-core.js.map +1 -0
- package/dist/angular/scss-compiler.d.ts.map +1 -0
- package/dist/angular/scss-compiler.js.map +1 -0
- package/dist/angular/vite-angular-plugin.d.ts +2 -10
- package/dist/angular/vite-angular-plugin.d.ts.map +1 -1
- package/dist/angular/vite-angular-plugin.js +20 -286
- package/dist/angular/vite-angular-plugin.js.map +1 -1
- package/dist/capacitor/capacitor-build.d.ts +14 -0
- package/dist/capacitor/capacitor-build.d.ts.map +1 -0
- package/dist/capacitor/capacitor-build.js +105 -0
- package/dist/capacitor/capacitor-build.js.map +1 -0
- package/dist/capacitor/capacitor-config-writer.d.ts +11 -0
- package/dist/capacitor/capacitor-config-writer.d.ts.map +1 -0
- package/dist/capacitor/capacitor-config-writer.js +54 -0
- package/dist/capacitor/capacitor-config-writer.js.map +1 -0
- package/dist/capacitor/capacitor-icon.d.ts +5 -0
- package/dist/capacitor/capacitor-icon.d.ts.map +1 -0
- package/dist/capacitor/capacitor-icon.js +58 -0
- package/dist/capacitor/capacitor-icon.js.map +1 -0
- package/dist/capacitor/capacitor-npm-config.d.ts +11 -0
- package/dist/capacitor/capacitor-npm-config.d.ts.map +1 -0
- package/dist/capacitor/capacitor-npm-config.js +145 -0
- package/dist/capacitor/capacitor-npm-config.js.map +1 -0
- package/dist/capacitor/capacitor.d.ts +0 -45
- package/dist/capacitor/capacitor.d.ts.map +1 -1
- package/dist/capacitor/capacitor.js +15 -354
- package/dist/capacitor/capacitor.js.map +1 -1
- package/dist/commands/check.js +2 -2
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/dev.d.ts +3 -3
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +3 -3
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/lint.d.ts +1 -1
- package/dist/commands/lint.d.ts.map +1 -1
- package/dist/commands/lint.js +1 -1
- package/dist/commands/lint.js.map +1 -1
- package/dist/commands/publish/deployment-phase.d.ts +12 -0
- package/dist/commands/publish/deployment-phase.d.ts.map +1 -0
- package/dist/commands/publish/deployment-phase.js +94 -0
- package/dist/commands/publish/deployment-phase.js.map +1 -0
- package/dist/commands/publish/env-utils.d.ts +10 -0
- package/dist/commands/publish/env-utils.d.ts.map +1 -0
- package/dist/commands/publish/env-utils.js +41 -0
- package/dist/commands/publish/env-utils.js.map +1 -0
- package/dist/commands/publish/git-phase.d.ts +12 -0
- package/dist/commands/publish/git-phase.d.ts.map +1 -0
- package/dist/commands/publish/git-phase.js +79 -0
- package/dist/commands/publish/git-phase.js.map +1 -0
- package/dist/commands/{publish.d.ts → publish/index.d.ts} +1 -1
- package/dist/commands/publish/index.d.ts.map +1 -0
- package/dist/commands/publish/index.js +211 -0
- package/dist/commands/publish/index.js.map +1 -0
- package/dist/commands/publish/local-publisher.d.ts +6 -0
- package/dist/commands/publish/local-publisher.d.ts.map +1 -0
- package/dist/commands/publish/local-publisher.js +16 -0
- package/dist/commands/publish/local-publisher.js.map +1 -0
- package/dist/commands/publish/npm-publisher.d.ts +6 -0
- package/dist/commands/publish/npm-publisher.d.ts.map +1 -0
- package/dist/commands/publish/npm-publisher.js +21 -0
- package/dist/commands/publish/npm-publisher.js.map +1 -0
- package/dist/commands/publish/post-publish-phase.d.ts +8 -0
- package/dist/commands/publish/post-publish-phase.d.ts.map +1 -0
- package/dist/commands/publish/post-publish-phase.js +34 -0
- package/dist/commands/publish/post-publish-phase.js.map +1 -0
- package/dist/commands/publish/storage-publisher.d.ts +18 -0
- package/dist/commands/publish/storage-publisher.d.ts.map +1 -0
- package/dist/commands/publish/storage-publisher.js +173 -0
- package/dist/commands/publish/storage-publisher.js.map +1 -0
- package/dist/commands/publish/version-upgrade.d.ts +28 -0
- package/dist/commands/publish/version-upgrade.d.ts.map +1 -0
- package/dist/commands/publish/version-upgrade.js +96 -0
- package/dist/commands/publish/version-upgrade.js.map +1 -0
- package/dist/commands/replace-deps.js +1 -1
- package/dist/commands/replace-deps.js.map +1 -1
- package/dist/commands/watch.d.ts +3 -4
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +3 -4
- package/dist/commands/watch.js.map +1 -1
- package/dist/deps/replace-deps/collect-deps.d.ts +6 -0
- package/dist/deps/replace-deps/collect-deps.d.ts.map +1 -0
- package/dist/deps/replace-deps/collect-deps.js +71 -0
- package/dist/deps/replace-deps/collect-deps.js.map +1 -0
- package/dist/{utils/replace-deps.d.ts → deps/replace-deps/replace-deps-resolve.d.ts} +7 -24
- package/dist/deps/replace-deps/replace-deps-resolve.d.ts.map +1 -0
- package/dist/{utils/replace-deps.js → deps/replace-deps/replace-deps-resolve.js} +4 -152
- package/dist/deps/replace-deps/replace-deps-resolve.js.map +1 -0
- package/dist/deps/replace-deps/replace-deps.d.ts +36 -0
- package/dist/deps/replace-deps/replace-deps.d.ts.map +1 -0
- package/dist/deps/replace-deps/replace-deps.js +155 -0
- package/dist/deps/replace-deps/replace-deps.js.map +1 -0
- package/dist/{utils → deps/server-externals}/server-production-files.d.ts +1 -1
- package/dist/deps/server-externals/server-production-files.d.ts.map +1 -0
- package/dist/{utils → deps/server-externals}/server-production-files.js +1 -1
- package/dist/deps/server-externals/server-production-files.js.map +1 -0
- package/dist/dev-server/dev-http-server.d.ts +23 -0
- package/dist/dev-server/dev-http-server.d.ts.map +1 -0
- package/dist/dev-server/dev-http-server.js +116 -0
- package/dist/dev-server/dev-http-server.js.map +1 -0
- package/dist/dev-server/hmr-client-script.d.ts +13 -0
- package/dist/dev-server/hmr-client-script.d.ts.map +1 -0
- package/dist/dev-server/hmr-client-script.js +73 -0
- package/dist/dev-server/hmr-client-script.js.map +1 -0
- package/dist/dev-server/hmr-service.d.ts +23 -0
- package/dist/dev-server/hmr-service.d.ts.map +1 -0
- package/dist/dev-server/hmr-service.js +139 -0
- package/dist/dev-server/hmr-service.js.map +1 -0
- package/dist/electron/electron.d.ts +5 -0
- package/dist/electron/electron.d.ts.map +1 -1
- package/dist/electron/electron.js +17 -24
- package/dist/electron/electron.js.map +1 -1
- package/dist/engines/BaseEngine.d.ts +18 -4
- package/dist/engines/BaseEngine.d.ts.map +1 -1
- package/dist/engines/BaseEngine.js +45 -66
- package/dist/engines/BaseEngine.js.map +1 -1
- package/dist/engines/{ViteEngine.d.ts → EsbuildClientEngine.d.ts} +11 -18
- package/dist/engines/EsbuildClientEngine.d.ts.map +1 -0
- package/dist/engines/{ViteEngine.js → EsbuildClientEngine.js} +28 -55
- package/dist/engines/EsbuildClientEngine.js.map +1 -0
- package/dist/engines/NgtscEngine.d.ts +2 -2
- package/dist/engines/NgtscEngine.d.ts.map +1 -1
- package/dist/engines/NgtscEngine.js +1 -9
- package/dist/engines/NgtscEngine.js.map +1 -1
- package/dist/engines/ServerEsbuildEngine.d.ts +2 -2
- package/dist/engines/ServerEsbuildEngine.d.ts.map +1 -1
- package/dist/engines/ServerEsbuildEngine.js +1 -9
- package/dist/engines/ServerEsbuildEngine.js.map +1 -1
- package/dist/engines/TscEngine.d.ts +2 -2
- package/dist/engines/TscEngine.d.ts.map +1 -1
- package/dist/engines/TscEngine.js +1 -9
- package/dist/engines/TscEngine.js.map +1 -1
- package/dist/engines/index.d.ts +15 -5
- package/dist/engines/index.d.ts.map +1 -1
- package/dist/engines/index.js +21 -5
- package/dist/engines/index.js.map +1 -1
- package/dist/engines/types.d.ts +3 -3
- package/dist/engines/types.d.ts.map +1 -1
- package/dist/esbuild/esbuild-client-config.d.ts +38 -0
- package/dist/esbuild/esbuild-client-config.d.ts.map +1 -0
- package/dist/esbuild/esbuild-client-config.js +171 -0
- package/dist/esbuild/esbuild-client-config.js.map +1 -0
- package/dist/esbuild/esbuild-config.d.ts.map +1 -0
- package/dist/{utils → esbuild}/esbuild-config.js +1 -0
- package/dist/esbuild/esbuild-config.js.map +1 -0
- package/dist/esbuild/esbuild-index-html.d.ts +39 -0
- package/dist/esbuild/esbuild-index-html.d.ts.map +1 -0
- package/dist/esbuild/esbuild-index-html.js +68 -0
- package/dist/esbuild/esbuild-index-html.js.map +1 -0
- package/dist/esbuild/esbuild-pwa.d.ts +21 -0
- package/dist/esbuild/esbuild-pwa.d.ts.map +1 -0
- package/dist/esbuild/esbuild-pwa.js +105 -0
- package/dist/esbuild/esbuild-pwa.js.map +1 -0
- package/dist/esbuild/esbuild-scss-plugin.d.ts +6 -0
- package/dist/esbuild/esbuild-scss-plugin.d.ts.map +1 -0
- package/dist/esbuild/esbuild-scss-plugin.js +41 -0
- package/dist/esbuild/esbuild-scss-plugin.js.map +1 -0
- package/dist/lint/lint-core.d.ts.map +1 -0
- package/dist/lint/lint-core.js.map +1 -0
- package/dist/lint/lint-utils.d.ts.map +1 -0
- package/dist/lint/lint-utils.js.map +1 -0
- package/dist/lint/lint-with-program.d.ts.map +1 -0
- package/dist/lint/lint-with-program.js.map +1 -0
- package/dist/orchestrators/BaseOrchestrator.d.ts +44 -0
- package/dist/orchestrators/BaseOrchestrator.d.ts.map +1 -0
- package/dist/orchestrators/BaseOrchestrator.js +92 -0
- package/dist/orchestrators/BaseOrchestrator.js.map +1 -0
- package/dist/orchestrators/BuildOrchestrator.d.ts +45 -3
- package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.js +170 -143
- package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
- package/dist/orchestrators/DevOrchestrator.d.ts +39 -0
- package/dist/orchestrators/DevOrchestrator.d.ts.map +1 -0
- package/dist/orchestrators/DevOrchestrator.js +249 -0
- package/dist/orchestrators/DevOrchestrator.js.map +1 -0
- package/dist/orchestrators/ServerRuntimeManager.d.ts +22 -0
- package/dist/orchestrators/ServerRuntimeManager.d.ts.map +1 -0
- package/dist/orchestrators/ServerRuntimeManager.js +66 -0
- package/dist/orchestrators/ServerRuntimeManager.js.map +1 -0
- package/dist/orchestrators/TypecheckOrchestrator.d.ts +17 -2
- package/dist/orchestrators/TypecheckOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/TypecheckOrchestrator.js +122 -108
- package/dist/orchestrators/TypecheckOrchestrator.js.map +1 -1
- package/dist/orchestrators/WatchOrchestrator.d.ts +33 -0
- package/dist/orchestrators/WatchOrchestrator.d.ts.map +1 -0
- package/dist/orchestrators/WatchOrchestrator.js +158 -0
- package/dist/orchestrators/WatchOrchestrator.js.map +1 -0
- package/dist/orchestrators/types.d.ts +17 -0
- package/dist/orchestrators/types.d.ts.map +1 -0
- package/dist/orchestrators/types.js +2 -0
- package/dist/orchestrators/types.js.map +1 -0
- package/dist/runtime/ResultCollector.d.ts.map +1 -0
- package/dist/runtime/ResultCollector.js.map +1 -0
- package/dist/runtime/SignalHandler.d.ts.map +1 -0
- package/dist/runtime/SignalHandler.js.map +1 -0
- package/dist/{utils → runtime}/engine-stop.d.ts +1 -1
- package/dist/runtime/engine-stop.d.ts.map +1 -0
- package/dist/{utils → runtime}/engine-stop.js +1 -1
- package/dist/runtime/engine-stop.js.map +1 -0
- package/dist/runtime/engine-watch-events.d.ts +43 -0
- package/dist/runtime/engine-watch-events.d.ts.map +1 -0
- package/dist/runtime/engine-watch-events.js +72 -0
- package/dist/runtime/engine-watch-events.js.map +1 -0
- package/dist/{utils → runtime}/rebuild-manager.d.ts +1 -0
- package/dist/runtime/rebuild-manager.d.ts.map +1 -0
- package/dist/{utils → runtime}/rebuild-manager.js +8 -1
- package/dist/runtime/rebuild-manager.js.map +1 -0
- package/dist/runtime/worker-events.d.ts +22 -0
- package/dist/runtime/worker-events.d.ts.map +1 -0
- package/dist/runtime/worker-events.js +2 -0
- package/dist/runtime/worker-events.js.map +1 -0
- package/dist/runtime/worker-utils.d.ts.map +1 -0
- package/dist/runtime/worker-utils.js.map +1 -0
- package/dist/sd-cli-entry.d.ts.map +1 -1
- package/dist/sd-cli-entry.js +61 -54
- package/dist/sd-cli-entry.js.map +1 -1
- package/dist/sd-cli.js +1 -1
- package/dist/sd-cli.js.map +1 -1
- package/dist/sd-config.types.d.ts +6 -15
- package/dist/sd-config.types.d.ts.map +1 -1
- package/dist/typecheck/typecheck-non-package.d.ts.map +1 -0
- package/dist/{utils → typecheck}/typecheck-non-package.js +1 -1
- package/dist/typecheck/typecheck-non-package.js.map +1 -0
- package/dist/typecheck/typecheck-serialization.d.ts.map +1 -0
- package/dist/typecheck/typecheck-serialization.js.map +1 -0
- package/dist/utils/diagnostic-utils.d.ts +5 -0
- package/dist/utils/diagnostic-utils.d.ts.map +1 -1
- package/dist/utils/diagnostic-utils.js +15 -0
- package/dist/utils/diagnostic-utils.js.map +1 -1
- package/dist/utils/orchestrator-utils.d.ts +1 -5
- package/dist/utils/orchestrator-utils.d.ts.map +1 -1
- package/dist/utils/orchestrator-utils.js +2 -5
- package/dist/utils/orchestrator-utils.js.map +1 -1
- package/dist/utils/output-utils.d.ts +1 -1
- package/dist/utils/output-utils.d.ts.map +1 -1
- package/dist/utils/package-classify.d.ts +54 -0
- package/dist/utils/package-classify.d.ts.map +1 -0
- package/dist/utils/package-classify.js +134 -0
- package/dist/utils/package-classify.js.map +1 -0
- package/dist/utils/package-utils.d.ts +1 -58
- package/dist/utils/package-utils.d.ts.map +1 -1
- package/dist/utils/package-utils.js +0 -193
- package/dist/utils/package-utils.js.map +1 -1
- package/dist/utils/tsc-build.d.ts +1 -1
- package/dist/utils/tsc-build.d.ts.map +1 -1
- package/dist/utils/tsc-build.js +1 -1
- package/dist/utils/tsc-build.js.map +1 -1
- package/dist/workers/build-change-filter.d.ts +8 -0
- package/dist/workers/build-change-filter.d.ts.map +1 -0
- package/dist/workers/build-change-filter.js +16 -0
- package/dist/workers/build-change-filter.js.map +1 -0
- package/dist/workers/build-watch-paths.d.ts +20 -0
- package/dist/workers/build-watch-paths.d.ts.map +1 -0
- package/dist/workers/build-watch-paths.js +29 -0
- package/dist/workers/build-watch-paths.js.map +1 -0
- package/dist/workers/client.worker.d.ts +11 -18
- package/dist/workers/client.worker.d.ts.map +1 -1
- package/dist/workers/client.worker.js +218 -289
- package/dist/workers/client.worker.js.map +1 -1
- package/dist/workers/library-build.worker.d.ts +2 -2
- package/dist/workers/library-build.worker.d.ts.map +1 -1
- package/dist/workers/library-build.worker.js +13 -24
- package/dist/workers/library-build.worker.js.map +1 -1
- package/dist/workers/lint.worker.d.ts +1 -1
- package/dist/workers/lint.worker.d.ts.map +1 -1
- package/dist/workers/lint.worker.js +1 -1
- package/dist/workers/lint.worker.js.map +1 -1
- package/dist/workers/ngtsc-build.worker.d.ts +1 -1
- package/dist/workers/ngtsc-build.worker.d.ts.map +1 -1
- package/dist/workers/ngtsc-build.worker.js +19 -35
- package/dist/workers/ngtsc-build.worker.js.map +1 -1
- package/dist/workers/server-build.worker.d.ts +2 -2
- package/dist/workers/server-build.worker.d.ts.map +1 -1
- package/dist/workers/server-build.worker.js +36 -137
- package/dist/workers/server-build.worker.js.map +1 -1
- package/dist/workers/server-esbuild-context.d.ts +47 -0
- package/dist/workers/server-esbuild-context.d.ts.map +1 -0
- package/dist/workers/server-esbuild-context.js +92 -0
- package/dist/workers/server-esbuild-context.js.map +1 -0
- package/dist/workers/server-runtime.worker.d.ts.map +1 -1
- package/dist/workers/server-runtime.worker.js +3 -1
- package/dist/workers/server-runtime.worker.js.map +1 -1
- package/dist/workers/server-watch-manager.d.ts +44 -0
- package/dist/workers/server-watch-manager.d.ts.map +1 -0
- package/dist/workers/server-watch-manager.js +87 -0
- package/dist/workers/server-watch-manager.js.map +1 -0
- package/dist/workers/shared-worker-lifecycle.d.ts +14 -0
- package/dist/workers/shared-worker-lifecycle.d.ts.map +1 -0
- package/dist/workers/shared-worker-lifecycle.js +17 -0
- package/dist/workers/shared-worker-lifecycle.js.map +1 -0
- package/package.json +9 -9
- package/src/{utils → angular}/angular-build-pipeline.ts +3 -8
- package/src/{utils → angular}/angular-build.ts +1 -1
- package/src/{utils → angular}/angular-compiler.ts +1 -64
- package/src/angular/client-transform-stylesheet.ts +1 -1
- package/src/{utils → angular}/ngtsc-build-core.ts +3 -3
- package/src/angular/vite-angular-plugin.ts +22 -355
- package/src/capacitor/capacitor-build.ts +142 -0
- package/src/capacitor/capacitor-config-writer.ts +66 -0
- package/src/capacitor/capacitor-icon.ts +75 -0
- package/src/capacitor/capacitor-npm-config.ts +192 -0
- package/src/capacitor/capacitor.ts +32 -441
- package/src/commands/check.ts +2 -2
- package/src/commands/dev.ts +6 -6
- package/src/commands/lint.ts +1 -1
- package/src/commands/publish/deployment-phase.ts +125 -0
- package/src/commands/publish/env-utils.ts +44 -0
- package/src/commands/publish/git-phase.ts +99 -0
- package/src/commands/publish/index.ts +266 -0
- package/src/commands/publish/local-publisher.ts +23 -0
- package/src/commands/publish/npm-publisher.ts +30 -0
- package/src/commands/publish/post-publish-phase.ts +43 -0
- package/src/commands/publish/storage-publisher.ts +208 -0
- package/src/commands/publish/version-upgrade.ts +132 -0
- package/src/commands/replace-deps.ts +1 -1
- package/src/commands/watch.ts +6 -7
- package/src/deps/replace-deps/collect-deps.ts +92 -0
- package/src/{utils/replace-deps.ts → deps/replace-deps/replace-deps-resolve.ts} +4 -188
- package/src/deps/replace-deps/replace-deps.ts +193 -0
- package/src/{utils → deps/server-externals}/server-production-files.ts +2 -2
- package/src/dev-server/dev-http-server.ts +149 -0
- package/src/dev-server/hmr-client-script.ts +74 -0
- package/src/dev-server/hmr-service.ts +178 -0
- package/src/electron/electron.ts +21 -28
- package/src/engines/BaseEngine.ts +64 -83
- package/src/engines/{ViteEngine.ts → EsbuildClientEngine.ts} +33 -72
- package/src/engines/NgtscEngine.ts +3 -11
- package/src/engines/ServerEsbuildEngine.ts +3 -11
- package/src/engines/TscEngine.ts +3 -11
- package/src/engines/index.ts +29 -9
- package/src/engines/types.ts +3 -3
- package/src/esbuild/esbuild-client-config.ts +230 -0
- package/src/{utils → esbuild}/esbuild-config.ts +1 -0
- package/src/esbuild/esbuild-index-html.ts +119 -0
- package/src/esbuild/esbuild-pwa.ts +139 -0
- package/src/esbuild/esbuild-scss-plugin.ts +48 -0
- package/src/orchestrators/BaseOrchestrator.ts +118 -0
- package/src/orchestrators/BuildOrchestrator.ts +234 -171
- package/src/orchestrators/DevOrchestrator.ts +315 -0
- package/src/orchestrators/ServerRuntimeManager.ts +85 -0
- package/src/orchestrators/TypecheckOrchestrator.ts +166 -117
- package/src/orchestrators/WatchOrchestrator.ts +203 -0
- package/src/orchestrators/types.ts +18 -0
- package/src/{utils → runtime}/engine-stop.ts +1 -1
- package/src/runtime/engine-watch-events.ts +121 -0
- package/src/{utils → runtime}/rebuild-manager.ts +8 -1
- package/src/runtime/worker-events.ts +25 -0
- package/src/sd-cli-entry.ts +69 -54
- package/src/sd-cli.ts +1 -1
- package/src/sd-config.types.ts +6 -16
- package/src/{utils → typecheck}/typecheck-non-package.ts +1 -1
- package/src/utils/diagnostic-utils.ts +15 -0
- package/src/utils/orchestrator-utils.ts +2 -6
- package/src/utils/output-utils.ts +1 -1
- package/src/utils/package-classify.ts +182 -0
- package/src/utils/package-utils.ts +0 -257
- package/src/utils/tsc-build.ts +1 -1
- package/src/workers/build-change-filter.ts +27 -0
- package/src/workers/build-watch-paths.ts +54 -0
- package/src/workers/client.worker.ts +258 -328
- package/src/workers/library-build.worker.ts +15 -34
- package/src/workers/lint.worker.ts +1 -1
- package/src/workers/ngtsc-build.worker.ts +19 -46
- package/src/workers/server-build.worker.ts +38 -168
- package/src/workers/server-esbuild-context.ts +122 -0
- package/src/workers/server-runtime.worker.ts +4 -1
- package/src/workers/server-watch-manager.ts +124 -0
- package/src/workers/shared-worker-lifecycle.ts +24 -0
- package/tests/angular/angular-build-pipeline.spec.ts +2 -2
- package/tests/angular/angular-compiler-aot.acc.spec.ts +68 -0
- package/tests/angular/angular-compiler-aot.spec.ts +80 -0
- package/tests/angular/angular-compiler-hmr-removal.verify.md +16 -0
- package/tests/angular/vite-angular-plugin-legacy-watch.spec.ts +0 -17
- package/tests/angular/vite-angular-plugin-vitest.spec.ts +1 -6
- package/tests/angular/vite-angular-plugin-vitest.verify.md +20 -0
- package/tests/angular/vite-angular-plugin.spec.ts +4 -178
- package/tests/capacitor/capacitor-android.spec.ts +1 -0
- package/tests/capacitor/capacitor-build.spec.ts +1 -0
- package/tests/capacitor/capacitor-config-writer.acc.spec.ts +108 -0
- package/tests/capacitor/capacitor-config-writer.spec.ts +95 -0
- package/tests/capacitor/capacitor-icon.spec.ts +1 -0
- package/tests/capacitor/capacitor-init.spec.ts +1 -0
- package/tests/capacitor/capacitor-npm-config.acc.spec.ts +236 -0
- package/tests/capacitor/capacitor-npm-config.spec.ts +132 -0
- package/tests/capacitor/capacitor-run.spec.ts +1 -0
- package/tests/capacitor/capacitor-workspace.spec.ts +1 -0
- package/tests/commands/check.spec.ts +2 -2
- package/tests/commands/deployment-phase.acc.spec.ts +142 -0
- package/tests/commands/git-phase.acc.spec.ts +158 -0
- package/tests/commands/lint.spec.ts +1 -1
- package/tests/commands/post-publish-phase.acc.spec.ts +82 -0
- package/tests/commands/publish-npm-local-split.verify.md +9 -0
- package/tests/commands/publish-responsibility-split.verify.md +13 -0
- package/tests/commands/publish-storage-split.verify.md +8 -0
- package/tests/commands/publish.spec.ts +1 -1
- package/tests/commands/typecheck.spec.ts +18 -18
- package/tests/deps/deps-directory-separation.verify.md +15 -0
- package/tests/engines/base-engine.spec.ts +65 -6
- package/tests/engines/engine-adapter-isolation.spec.ts +11 -18
- package/tests/engines/engine-selection.spec.ts +38 -5
- package/tests/engines/engine-typecheck-selection.acc.spec.ts +85 -0
- package/tests/engines/engine-typecheck-selection.verify.md +8 -0
- package/tests/engines/esbuild-client-engine.acc.spec.ts +161 -0
- package/tests/engines/esbuild-client-engine.spec.ts +320 -0
- package/tests/engines/esbuild-client-engine.verify.md +15 -0
- package/tests/engines/normalize-result.verify.md +9 -0
- package/tests/engines/vite-dependency-cleanup.verify.md +24 -0
- package/tests/orchestrators/build-orchestrator.spec.ts +3 -3
- package/tests/orchestrators/dev-orchestrator.spec.ts +799 -0
- package/tests/orchestrators/orchestrator-baseenv.verify.md +10 -0
- package/tests/orchestrators/orchestrator-diagnostic-formatting.verify.md +10 -0
- package/tests/orchestrators/orchestrator-initializemode-signature.verify.md +9 -0
- package/tests/orchestrators/typecheck-orchestrator.spec.ts +11 -11
- package/tests/orchestrators/watch-orchestrator.spec.ts +511 -0
- package/tests/{infra → runtime}/result-collector.spec.ts +1 -1
- package/tests/{infra → runtime}/signal-handler.spec.ts +1 -1
- package/tests/sd-cli-entry.spec.ts +9 -0
- package/tests/utils/angular-build.spec.ts +15 -20
- package/tests/utils/angular-compiler-emit.spec.ts +2 -2
- package/tests/utils/angular-compiler.spec.ts +2 -2
- package/tests/utils/angular-source-file-cache.spec.ts +2 -2
- package/tests/utils/concurrency.spec.ts +2 -10
- package/tests/utils/dev-http-server.acc.spec.ts +206 -0
- package/tests/utils/dev-http-server.spec.ts +181 -0
- package/tests/utils/dev-http-server.verify.md +8 -0
- package/tests/utils/diagnostic-utils.spec.ts +42 -1
- package/tests/utils/engine-stop.spec.ts +1 -1
- package/tests/utils/engine-watch-events.acc.spec.ts +217 -0
- package/tests/utils/engine-watch-events.spec.ts +141 -0
- package/tests/utils/engine-watch-events.verify.md +17 -0
- package/tests/utils/esbuild-client-config.acc.spec.ts +443 -0
- package/tests/utils/esbuild-client-config.spec.ts +590 -0
- package/tests/utils/esbuild-client-config.verify.md +26 -0
- package/tests/utils/esbuild-config.spec.ts +11 -1
- package/tests/utils/esbuild-index-html.acc.spec.ts +166 -0
- package/tests/utils/esbuild-index-html.spec.ts +194 -0
- package/tests/utils/esbuild-index-html.verify.md +10 -0
- package/tests/utils/esbuild-pwa.acc.spec.ts +203 -0
- package/tests/utils/esbuild-pwa.spec.ts +189 -0
- package/tests/utils/esbuild-pwa.verify.md +9 -0
- package/tests/utils/esbuild-scss-plugin.acc.spec.ts +111 -0
- package/tests/utils/esbuild-scss-plugin.spec.ts +150 -0
- package/tests/utils/esbuild-scss-plugin.verify.md +8 -0
- package/tests/utils/external-modules.spec.ts +1 -1
- package/tests/utils/hmr-client-script.acc.spec.ts +128 -0
- package/tests/utils/hmr-client-script.spec.ts +44 -0
- package/tests/utils/hmr-service-dispatcher.acc.spec.ts +217 -0
- package/tests/utils/hmr-service-dispatcher.spec.ts +143 -0
- package/tests/utils/hmr-service.acc.spec.ts +139 -0
- package/tests/utils/hmr-service.spec.ts +131 -0
- package/tests/utils/hmr-service.verify.md +17 -0
- package/tests/utils/lint-core.spec.ts +2 -1
- package/tests/utils/lint-utils.spec.ts +1 -1
- package/tests/utils/lint-with-program.spec.ts +1 -1
- package/tests/utils/ngtsc-build-core-write-emit.spec.ts +19 -19
- package/tests/utils/ngtsc-build-core.spec.ts +4 -4
- package/tests/utils/orchestrator-utils.spec.ts +2 -2
- package/tests/utils/output-utils.spec.ts +1 -1
- package/tests/utils/package-utils.spec.ts +1 -1
- package/tests/utils/rebuild-manager.spec.ts +20 -7
- package/tests/utils/replace-deps-split.verify.md +15 -0
- package/tests/utils/replace-deps-watch.acc.spec.ts +131 -0
- package/tests/utils/replace-deps-watch.spec.ts +91 -0
- package/tests/utils/replace-deps-watch.verify.md +9 -0
- package/tests/utils/replace-deps.spec.ts +1 -1
- package/tests/utils/scss-compiler.spec.ts +1 -1
- package/tests/utils/tsc-build.spec.ts +1 -1
- package/tests/utils/typecheck-non-package.spec.ts +2 -2
- package/tests/utils/worker-utils.spec.ts +2 -1
- package/tests/workers/build-change-filter.acc.spec.ts +78 -0
- package/tests/workers/build-change-filter.spec.ts +39 -0
- package/tests/workers/build-watch-paths-library.verify.md +10 -0
- package/tests/workers/build-watch-paths-ngtsc-server.verify.md +12 -0
- package/tests/workers/build-watch-paths.acc.spec.ts +101 -0
- package/tests/workers/build-watch-paths.spec.ts +121 -0
- package/tests/workers/client-worker-browser-support.verify.md +7 -0
- package/tests/workers/client-worker-onend-sync.verify.md +7 -0
- package/tests/workers/client-worker.acc.spec.ts +185 -0
- package/tests/workers/client-worker.spec.ts +91 -178
- package/tests/workers/library-build-lint.spec.ts +3 -3
- package/tests/workers/library-build-worker.spec.ts +10 -11
- package/tests/workers/ngtsc-build-lint.spec.ts +4 -4
- package/tests/workers/ngtsc-build-worker.spec.ts +2 -2
- package/tests/workers/server-build-lint.spec.ts +4 -4
- package/tests/workers/server-build-worker.spec.ts +14 -15
- package/tests/workers/server-esbuild-context-integration.verify.md +10 -0
- package/tests/workers/server-esbuild-context.acc.spec.ts +98 -0
- package/tests/workers/server-esbuild-context.spec.ts +198 -0
- package/tests/workers/server-runtime-worker.spec.ts +4 -3
- package/tests/workers/server-watch-manager.acc.spec.ts +162 -0
- package/tests/workers/server-watch-manager.spec.ts +199 -0
- package/tests/workers/shared-worker-lifecycle.acc.spec.ts +27 -0
- package/tests/workers/shared-worker-lifecycle.spec.ts +47 -0
- package/dist/angular/vite-postcss-inline-plugin.d.ts +0 -18
- package/dist/angular/vite-postcss-inline-plugin.d.ts.map +0 -1
- package/dist/angular/vite-postcss-inline-plugin.js +0 -108
- package/dist/angular/vite-postcss-inline-plugin.js.map +0 -1
- package/dist/commands/publish.d.ts.map +0 -1
- package/dist/commands/publish.js +0 -689
- package/dist/commands/publish.js.map +0 -1
- package/dist/engines/ViteEngine.d.ts.map +0 -1
- package/dist/engines/ViteEngine.js.map +0 -1
- package/dist/infra/ResultCollector.d.ts.map +0 -1
- package/dist/infra/ResultCollector.js.map +0 -1
- package/dist/infra/SignalHandler.d.ts.map +0 -1
- package/dist/infra/SignalHandler.js.map +0 -1
- package/dist/orchestrators/DevWatchOrchestrator.d.ts +0 -63
- package/dist/orchestrators/DevWatchOrchestrator.d.ts.map +0 -1
- package/dist/orchestrators/DevWatchOrchestrator.js +0 -478
- package/dist/orchestrators/DevWatchOrchestrator.js.map +0 -1
- package/dist/utils/angular-build-pipeline.d.ts.map +0 -1
- package/dist/utils/angular-build-pipeline.js.map +0 -1
- package/dist/utils/angular-build.d.ts.map +0 -1
- package/dist/utils/angular-build.js.map +0 -1
- package/dist/utils/angular-compiler.d.ts.map +0 -1
- package/dist/utils/angular-compiler.js.map +0 -1
- package/dist/utils/engine-stop.d.ts.map +0 -1
- package/dist/utils/engine-stop.js.map +0 -1
- package/dist/utils/esbuild-config.d.ts.map +0 -1
- package/dist/utils/esbuild-config.js.map +0 -1
- package/dist/utils/hmr-candidates.d.ts +0 -15
- package/dist/utils/hmr-candidates.d.ts.map +0 -1
- package/dist/utils/hmr-candidates.js +0 -234
- package/dist/utils/hmr-candidates.js.map +0 -1
- package/dist/utils/lint-core.d.ts.map +0 -1
- package/dist/utils/lint-core.js.map +0 -1
- package/dist/utils/lint-utils.d.ts.map +0 -1
- package/dist/utils/lint-utils.js.map +0 -1
- package/dist/utils/lint-with-program.d.ts.map +0 -1
- package/dist/utils/lint-with-program.js.map +0 -1
- package/dist/utils/ngtsc-build-core.d.ts.map +0 -1
- package/dist/utils/ngtsc-build-core.js.map +0 -1
- package/dist/utils/rebuild-manager.d.ts.map +0 -1
- package/dist/utils/rebuild-manager.js.map +0 -1
- package/dist/utils/replace-deps.d.ts.map +0 -1
- package/dist/utils/replace-deps.js.map +0 -1
- package/dist/utils/scss-compiler.d.ts.map +0 -1
- package/dist/utils/scss-compiler.js.map +0 -1
- package/dist/utils/server-production-files.d.ts.map +0 -1
- package/dist/utils/server-production-files.js.map +0 -1
- package/dist/utils/typecheck-non-package.d.ts.map +0 -1
- package/dist/utils/typecheck-non-package.js.map +0 -1
- package/dist/utils/typecheck-serialization.d.ts.map +0 -1
- package/dist/utils/typecheck-serialization.js.map +0 -1
- package/dist/utils/vite-config.d.ts +0 -50
- package/dist/utils/vite-config.d.ts.map +0 -1
- package/dist/utils/vite-config.js +0 -242
- package/dist/utils/vite-config.js.map +0 -1
- package/dist/utils/vite-pwa-plugin.d.ts +0 -9
- package/dist/utils/vite-pwa-plugin.d.ts.map +0 -1
- package/dist/utils/vite-pwa-plugin.js +0 -139
- package/dist/utils/vite-pwa-plugin.js.map +0 -1
- package/dist/utils/vite-scope-watch-plugin.d.ts +0 -24
- package/dist/utils/vite-scope-watch-plugin.d.ts.map +0 -1
- package/dist/utils/vite-scope-watch-plugin.js +0 -51
- package/dist/utils/vite-scope-watch-plugin.js.map +0 -1
- package/dist/utils/worker-events.d.ts +0 -66
- package/dist/utils/worker-events.d.ts.map +0 -1
- package/dist/utils/worker-events.js +0 -55
- package/dist/utils/worker-events.js.map +0 -1
- package/dist/utils/worker-utils.d.ts.map +0 -1
- package/dist/utils/worker-utils.js.map +0 -1
- package/src/angular/vite-postcss-inline-plugin.ts +0 -139
- package/src/commands/publish.ts +0 -850
- package/src/orchestrators/DevWatchOrchestrator.ts +0 -594
- package/src/utils/hmr-candidates.ts +0 -327
- package/src/utils/vite-config.ts +0 -318
- package/src/utils/vite-pwa-plugin.ts +0 -168
- package/src/utils/vite-scope-watch-plugin.ts +0 -77
- package/src/utils/worker-events.ts +0 -128
- package/tests/angular/angular-compiler-hmr.spec.ts +0 -152
- package/tests/angular/hmr-candidates.spec.ts +0 -158
- package/tests/angular/linker-disk-cache.spec.ts +0 -171
- package/tests/angular/vite-angular-plugin-hmr-fallback.spec.ts +0 -333
- package/tests/angular/vite-angular-plugin-hmr.spec.ts +0 -320
- package/tests/angular/vite-angular-plugin-scss-hmr.spec.ts +0 -95
- package/tests/angular/vite-postcss-inline-plugin.spec.ts +0 -60
- package/tests/engines/vite-engine.spec.ts +0 -409
- package/tests/orchestrators/dev-watch-orchestrator.spec.ts +0 -1542
- package/tests/utils/vite-config.spec.ts +0 -780
- package/tests/utils/vite-pwa-plugin.spec.ts +0 -401
- package/tests/utils/vite-scope-watch-plugin.spec.ts +0 -218
- package/tests/utils/worker-events.spec.ts +0 -147
- package/tests/workers/client-worker-legacy.spec.ts +0 -659
- /package/dist/{utils → angular}/ngtsc-build-core.js +0 -0
- /package/dist/{utils → angular}/scss-compiler.d.ts +0 -0
- /package/dist/{utils → angular}/scss-compiler.js +0 -0
- /package/dist/{utils → esbuild}/esbuild-config.d.ts +0 -0
- /package/dist/{utils → lint}/lint-core.d.ts +0 -0
- /package/dist/{utils → lint}/lint-core.js +0 -0
- /package/dist/{utils → lint}/lint-utils.d.ts +0 -0
- /package/dist/{utils → lint}/lint-utils.js +0 -0
- /package/dist/{utils → lint}/lint-with-program.d.ts +0 -0
- /package/dist/{utils → lint}/lint-with-program.js +0 -0
- /package/dist/{infra → runtime}/ResultCollector.d.ts +0 -0
- /package/dist/{infra → runtime}/ResultCollector.js +0 -0
- /package/dist/{infra → runtime}/SignalHandler.d.ts +0 -0
- /package/dist/{infra → runtime}/SignalHandler.js +0 -0
- /package/dist/{utils → runtime}/worker-utils.d.ts +0 -0
- /package/dist/{utils → runtime}/worker-utils.js +0 -0
- /package/dist/{utils → typecheck}/typecheck-non-package.d.ts +0 -0
- /package/dist/{utils → typecheck}/typecheck-serialization.d.ts +0 -0
- /package/dist/{utils → typecheck}/typecheck-serialization.js +0 -0
- /package/src/{utils → angular}/scss-compiler.ts +0 -0
- /package/src/{utils → lint}/lint-core.ts +0 -0
- /package/src/{utils → lint}/lint-utils.ts +0 -0
- /package/src/{utils → lint}/lint-with-program.ts +0 -0
- /package/src/{infra → runtime}/ResultCollector.ts +0 -0
- /package/src/{infra → runtime}/SignalHandler.ts +0 -0
- /package/src/{utils → runtime}/worker-utils.ts +0 -0
- /package/src/{utils → typecheck}/typecheck-serialization.ts +0 -0
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import type { NgtscProgram } from "./angular-build.js";
|
|
3
|
-
|
|
4
|
-
type NgCompiler = NgtscProgram["compiler"];
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* HMR에서 지원하는 Angular @Component 메타데이터 필드 이름.
|
|
8
|
-
* 이 필드만 변경된 경우 HMR 후보로 판정된다.
|
|
9
|
-
*/
|
|
10
|
-
const SUPPORTED_FIELD_NAMES = new Set([
|
|
11
|
-
"template",
|
|
12
|
-
"templateUrl",
|
|
13
|
-
"styles",
|
|
14
|
-
"styleUrl",
|
|
15
|
-
"stylesUrl",
|
|
16
|
-
]);
|
|
17
|
-
|
|
18
|
-
const enum MetaUpdateAnalysis {
|
|
19
|
-
Supported = 0,
|
|
20
|
-
Unsupported = 1,
|
|
21
|
-
None = 2,
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 수정된 파일들을 분석하여 HMR 후보 컴포넌트를 수집한다.
|
|
26
|
-
* 하나의 파일이라도 비지원 변경이면 전체 HMR을 취소한다 (all-or-nothing).
|
|
27
|
-
*/
|
|
28
|
-
export function collectHmrCandidates(
|
|
29
|
-
modifiedFiles: ReadonlySet<string>,
|
|
30
|
-
compiler: NgCompiler,
|
|
31
|
-
staleSourceFiles: ReadonlyMap<string, ts.SourceFile>,
|
|
32
|
-
): Set<ts.ClassDeclaration> {
|
|
33
|
-
const candidates = new Set<ts.ClassDeclaration>();
|
|
34
|
-
|
|
35
|
-
for (const file of modifiedFiles) {
|
|
36
|
-
// 템플릿 파일이면 해당 컴포넌트를 후보에 추가
|
|
37
|
-
const templateFileNodes = compiler.getComponentsWithTemplateFile(file);
|
|
38
|
-
if (templateFileNodes.size > 0) {
|
|
39
|
-
for (const node of templateFileNodes) {
|
|
40
|
-
candidates.add(node as ts.ClassDeclaration);
|
|
41
|
-
}
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// 스타일 파일이면 해당 컴포넌트를 후보에 추가
|
|
46
|
-
const styleFileNodes = compiler.getComponentsWithStyleFile(file);
|
|
47
|
-
if (styleFileNodes.size > 0) {
|
|
48
|
-
for (const node of styleFileNodes) {
|
|
49
|
-
candidates.add(node as ts.ClassDeclaration);
|
|
50
|
-
}
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// stale source가 없으면 전체 무효화
|
|
55
|
-
const staleSource = staleSourceFiles.get(file);
|
|
56
|
-
if (staleSource === undefined) {
|
|
57
|
-
candidates.clear();
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// current source가 없으면 전체 무효화
|
|
62
|
-
const updatedSource = compiler.getCurrentProgram().getSourceFile(file);
|
|
63
|
-
if (updatedSource === undefined) {
|
|
64
|
-
candidates.clear();
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// AST 비교로 HMR 후보 분석
|
|
69
|
-
const fileCandidates = analyzeFileUpdates(staleSource, updatedSource, compiler);
|
|
70
|
-
if (fileCandidates != null) {
|
|
71
|
-
for (const node of fileCandidates) {
|
|
72
|
-
candidates.add(node);
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
// 비지원 변경 → 전체 무효화
|
|
76
|
-
candidates.clear();
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return candidates;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* stale/current 소스 파일의 AST를 비교하여 HMR 후보를 판별한다.
|
|
86
|
-
* @returns HMR 후보 ClassDeclaration 배열. null이면 비지원 변경.
|
|
87
|
-
*/
|
|
88
|
-
export function analyzeFileUpdates(
|
|
89
|
-
stale: ts.SourceFile,
|
|
90
|
-
updated: ts.SourceFile,
|
|
91
|
-
compiler?: NgCompiler,
|
|
92
|
-
): ts.ClassDeclaration[] | null {
|
|
93
|
-
if (stale.statements.length !== updated.statements.length) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const candidates: ts.ClassDeclaration[] = [];
|
|
98
|
-
|
|
99
|
-
for (let i = 0; i < updated.statements.length; ++i) {
|
|
100
|
-
const updatedNode = updated.statements[i];
|
|
101
|
-
const staleNode = stale.statements[i];
|
|
102
|
-
|
|
103
|
-
if (ts.isClassDeclaration(updatedNode)) {
|
|
104
|
-
if (!ts.isClassDeclaration(staleNode)) {
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// name 비교
|
|
109
|
-
if (updatedNode.name?.text !== staleNode.name?.text) {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// heritage 비교
|
|
114
|
-
if (!equalRangeText(updatedNode.heritageClauses, updated, staleNode.heritageClauses, stale)) {
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// modifiers 비교
|
|
119
|
-
const updatedModifiers = ts.getModifiers(updatedNode);
|
|
120
|
-
const staleModifiers = ts.getModifiers(staleNode);
|
|
121
|
-
if (
|
|
122
|
-
updatedModifiers?.length !== staleModifiers?.length ||
|
|
123
|
-
!updatedModifiers?.every((updatedModifier) =>
|
|
124
|
-
staleModifiers?.some((staleModifier) => updatedModifier.kind === staleModifier.kind),
|
|
125
|
-
)
|
|
126
|
-
) {
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// @Component 메타 확인 (compiler 없으면 non-component로 취급)
|
|
131
|
-
if (compiler != null) {
|
|
132
|
-
const meta = (compiler as any).getMeta(updatedNode);
|
|
133
|
-
if (meta?.decorator != null && meta.isComponent === true) {
|
|
134
|
-
const updatedDecorators = ts.getDecorators(updatedNode);
|
|
135
|
-
const staleDecorators = ts.getDecorators(staleNode);
|
|
136
|
-
|
|
137
|
-
if (
|
|
138
|
-
staleDecorators == null ||
|
|
139
|
-
staleDecorators.length !== updatedDecorators?.length
|
|
140
|
-
) {
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// 다중 데코레이터는 미지원
|
|
145
|
-
if (staleDecorators.length > 1) {
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// 데코레이터 인덱스 확인
|
|
150
|
-
const metaDecoratorIndex = updatedDecorators.indexOf(meta.decorator);
|
|
151
|
-
if (metaDecoratorIndex < 0) {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const updatedDecoratorExpression = meta.decorator.expression;
|
|
156
|
-
if (
|
|
157
|
-
!ts.isCallExpression(updatedDecoratorExpression) ||
|
|
158
|
-
updatedDecoratorExpression.arguments.length !== 1
|
|
159
|
-
) {
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const staleDecoratorExpression = staleDecorators[metaDecoratorIndex].expression;
|
|
164
|
-
if (
|
|
165
|
-
!ts.isCallExpression(staleDecoratorExpression) ||
|
|
166
|
-
staleDecoratorExpression.arguments.length !== 1
|
|
167
|
-
) {
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// 데코레이터 이름/expression 비교
|
|
172
|
-
if (
|
|
173
|
-
!equalRangeText(
|
|
174
|
-
updatedDecoratorExpression.expression,
|
|
175
|
-
updated,
|
|
176
|
-
staleDecoratorExpression.expression,
|
|
177
|
-
stale,
|
|
178
|
-
)
|
|
179
|
-
) {
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// 메타데이터 비교
|
|
184
|
-
const analysis = analyzeMetaUpdates(
|
|
185
|
-
staleDecoratorExpression,
|
|
186
|
-
stale,
|
|
187
|
-
updatedDecoratorExpression,
|
|
188
|
-
updated,
|
|
189
|
-
);
|
|
190
|
-
if (analysis === MetaUpdateAnalysis.Unsupported) {
|
|
191
|
-
return null;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// 클래스 멤버 비교
|
|
195
|
-
if (!equalRangeText(updatedNode.members, updated, staleNode.members, stale)) {
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// 지원 변경이면 후보에 추가
|
|
200
|
-
if (analysis === MetaUpdateAnalysis.Supported) {
|
|
201
|
-
candidates.push(updatedNode);
|
|
202
|
-
}
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// non-component 클래스: 텍스트 변경 확인
|
|
208
|
-
if (!equalRangeText(updatedNode, updated, staleNode, stale)) {
|
|
209
|
-
return null;
|
|
210
|
-
}
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// 기타 statement: 텍스트 비교
|
|
215
|
-
if (!equalRangeText(updatedNode, updated, staleNode, stale)) {
|
|
216
|
-
return null;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
return candidates;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* @Component 데코레이터의 메타데이터 필드를 비���한다.
|
|
225
|
-
* 지원 필드만 변경되었으면 Supported, 비지원 필드가 변경되면 Unsupported.
|
|
226
|
-
*/
|
|
227
|
-
function analyzeMetaUpdates(
|
|
228
|
-
staleCall: ts.CallExpression,
|
|
229
|
-
staleSource: ts.SourceFile,
|
|
230
|
-
updatedCall: ts.CallExpression,
|
|
231
|
-
updatedSource: ts.SourceFile,
|
|
232
|
-
): MetaUpdateAnalysis {
|
|
233
|
-
const staleObject = staleCall.arguments[0];
|
|
234
|
-
const updatedObject = updatedCall.arguments[0];
|
|
235
|
-
|
|
236
|
-
if (
|
|
237
|
-
!ts.isObjectLiteralExpression(staleObject) ||
|
|
238
|
-
!ts.isObjectLiteralExpression(updatedObject)
|
|
239
|
-
) {
|
|
240
|
-
return MetaUpdateAnalysis.Unsupported;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
let hasSupportedUpdate = false;
|
|
244
|
-
const supportedFields = new Map<string, ts.Expression>();
|
|
245
|
-
const unsupportedFields: ts.Expression[] = [];
|
|
246
|
-
|
|
247
|
-
for (const property of staleObject.properties) {
|
|
248
|
-
if (!ts.isPropertyAssignment(property) || ts.isComputedPropertyName(property.name)) {
|
|
249
|
-
return MetaUpdateAnalysis.Unsupported;
|
|
250
|
-
}
|
|
251
|
-
const name = (property.name as ts.Identifier).text;
|
|
252
|
-
if (SUPPORTED_FIELD_NAMES.has(name)) {
|
|
253
|
-
supportedFields.set(name, property.initializer);
|
|
254
|
-
continue;
|
|
255
|
-
}
|
|
256
|
-
unsupportedFields.push(property.initializer);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
let unsupportedIdx = 0;
|
|
260
|
-
for (const property of updatedObject.properties) {
|
|
261
|
-
if (!ts.isPropertyAssignment(property) || ts.isComputedPropertyName(property.name)) {
|
|
262
|
-
return MetaUpdateAnalysis.Unsupported;
|
|
263
|
-
}
|
|
264
|
-
const name = (property.name as ts.Identifier).text;
|
|
265
|
-
if (SUPPORTED_FIELD_NAMES.has(name)) {
|
|
266
|
-
const staleInitializer = supportedFields.get(name);
|
|
267
|
-
if (
|
|
268
|
-
staleInitializer == null ||
|
|
269
|
-
!equalRangeText(property.initializer, updatedSource, staleInitializer, staleSource)
|
|
270
|
-
) {
|
|
271
|
-
hasSupportedUpdate = true;
|
|
272
|
-
}
|
|
273
|
-
supportedFields.delete(name);
|
|
274
|
-
continue;
|
|
275
|
-
}
|
|
276
|
-
if (
|
|
277
|
-
!equalRangeText(
|
|
278
|
-
property.initializer,
|
|
279
|
-
updatedSource,
|
|
280
|
-
unsupportedFields[unsupportedIdx++],
|
|
281
|
-
staleSource,
|
|
282
|
-
)
|
|
283
|
-
) {
|
|
284
|
-
return MetaUpdateAnalysis.Unsupported;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
if (unsupportedIdx !== unsupportedFields.length) {
|
|
289
|
-
return MetaUpdateAnalysis.Unsupported;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
// 남은 supported field가 있으면 삭제된 것 → supported update
|
|
293
|
-
hasSupportedUpdate ||= supportedFields.size > 0;
|
|
294
|
-
|
|
295
|
-
return hasSupportedUpdate ? MetaUpdateAnalysis.Supported : MetaUpdateAnalysis.None;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* 두 소스 파일에서 지정된 범위의 텍스트를 비교한다.
|
|
300
|
-
* 중간 문자열 복사를 피하여 효율적으로 비교한다.
|
|
301
|
-
*/
|
|
302
|
-
function equalRangeText(
|
|
303
|
-
firstRange: ts.TextRange | ts.NodeArray<ts.Node> | undefined,
|
|
304
|
-
firstSource: ts.SourceFile,
|
|
305
|
-
secondRange: ts.TextRange | ts.NodeArray<ts.Node> | undefined,
|
|
306
|
-
secondSource: ts.SourceFile,
|
|
307
|
-
): boolean {
|
|
308
|
-
if (firstRange == null || secondRange == null) {
|
|
309
|
-
return firstRange === secondRange;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
const firstLength = firstRange.end - firstRange.pos;
|
|
313
|
-
const secondLength = secondRange.end - secondRange.pos;
|
|
314
|
-
if (firstLength !== secondLength) {
|
|
315
|
-
return false;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
for (let i = 0; i < firstLength; ++i) {
|
|
319
|
-
if (
|
|
320
|
-
firstSource.text.charCodeAt(i + firstRange.pos) !==
|
|
321
|
-
secondSource.text.charCodeAt(i + secondRange.pos)
|
|
322
|
-
) {
|
|
323
|
-
return false;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
return true;
|
|
327
|
-
}
|
package/src/utils/vite-config.ts
DELETED
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
import type { InlineConfig, PluginOption } from "vite";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import tsconfigPaths from "vite-tsconfig-paths";
|
|
4
|
-
import browserslistToEsbuild from "browserslist-to-esbuild";
|
|
5
|
-
import { sdAngularPlugin } from "../angular/vite-angular-plugin.js";
|
|
6
|
-
import solidPlugin from "vite-plugin-solid";
|
|
7
|
-
import {
|
|
8
|
-
sdScopeWatchPlugin,
|
|
9
|
-
type ScopeWatchReplaceDep,
|
|
10
|
-
} from "./vite-scope-watch-plugin.js";
|
|
11
|
-
import { sdPostCssInlinePlugin } from "../angular/vite-postcss-inline-plugin.js";
|
|
12
|
-
import type { SdPwaConfig } from "../sd-config.types.js";
|
|
13
|
-
import { VitePWA } from "vite-plugin-pwa";
|
|
14
|
-
import { generatePwaIcons } from "./generate-pwa-icons.js";
|
|
15
|
-
import { loadSdConfig } from "./sd-config.js";
|
|
16
|
-
|
|
17
|
-
/** createClientViteConfig 옵션 */
|
|
18
|
-
export interface CreateClientViteConfigOptions {
|
|
19
|
-
/** 클라이언트 프레임워크 선택. 미지정 시 "angular" */
|
|
20
|
-
framework?: "angular" | "solid";
|
|
21
|
-
/** 패키지 디렉토리 경로 */
|
|
22
|
-
pkgDir: string;
|
|
23
|
-
/** 패키지명 (예: "@scope/my-client") */
|
|
24
|
-
pkgName: string;
|
|
25
|
-
/** 모드 */
|
|
26
|
-
mode: "dev" | "build";
|
|
27
|
-
/** Vite dev server 포트 (0: 자동 할당, >0: 지정) */
|
|
28
|
-
serverPort: number;
|
|
29
|
-
/** 빌드 시 치환할 환경변수 */
|
|
30
|
-
env?: Record<string, string>;
|
|
31
|
-
/** rebuild 시작 콜백 (CLI 상태 보고용) */
|
|
32
|
-
onBuildStart?: () => void;
|
|
33
|
-
/** rebuild 완료 콜백 (CLI 상태 보고용) */
|
|
34
|
-
onBuild?: (result: {
|
|
35
|
-
success: boolean;
|
|
36
|
-
errors?: string[];
|
|
37
|
-
warnings?: string[];
|
|
38
|
-
}) => void;
|
|
39
|
-
/** replaceDeps 목록 (dev 모드에서 sdScopeWatchPlugin에 전달) */
|
|
40
|
-
replaceDeps?: ScopeWatchReplaceDep[];
|
|
41
|
-
/** replaceDeps 변경 감지 콜백 */
|
|
42
|
-
onScopeRebuild?: () => void;
|
|
43
|
-
/** polyfills 경로 배열 (transformIndexHtml로 주입) */
|
|
44
|
-
polyfills?: string[];
|
|
45
|
-
/** PWA 설정. false로 비활성화. 미설정 시 기본값으로 활성화 */
|
|
46
|
-
pwa?: false | SdPwaConfig;
|
|
47
|
-
/** Vite optimizeDeps.exclude에 전달할 패키지 목록 */
|
|
48
|
-
exclude?: string[];
|
|
49
|
-
/** watch 모드 (build.watch 활성화, emptyOutDir: false) */
|
|
50
|
-
watch?: boolean;
|
|
51
|
-
/** 빌드 출력 경로 (미설정 시 pkgDir/dist) */
|
|
52
|
-
outDir?: string;
|
|
53
|
-
/** Vite base 경로 (미설정 시 /{pkgName}/) */
|
|
54
|
-
base?: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Client Vite 설정을 생성한다. dev/build 모드에서 공용으로 사용한다.
|
|
59
|
-
*
|
|
60
|
-
* Angular AOT 플러그인, tsconfigPaths, env define, server/build 기본 설정,
|
|
61
|
-
* browserslist, PostCSS, polyfills, legacyModule (inlineDynamicImports) 등을 통합 구성한다.
|
|
62
|
-
*/
|
|
63
|
-
export async function createClientViteConfig(
|
|
64
|
-
options: CreateClientViteConfigOptions,
|
|
65
|
-
): Promise<InlineConfig> {
|
|
66
|
-
const name = options.pkgName.replace(/^@[^/]+\//, "");
|
|
67
|
-
|
|
68
|
-
// sd.config.ts 로딩 + browserSupport 추출
|
|
69
|
-
const sdConfig = await loadSdConfig({ cwd: process.cwd(), dev: options.mode === "dev", opt: [] });
|
|
70
|
-
const pkgConfig = sdConfig.packages[name];
|
|
71
|
-
if (pkgConfig == null) {
|
|
72
|
-
throw new Error(`sd.config.ts에 패키지 "${name}"가 정의되어 있지 않습니다.`);
|
|
73
|
-
}
|
|
74
|
-
const browserSupport = pkgConfig.target === "client" ? pkgConfig.browserSupport : undefined;
|
|
75
|
-
const browserslist = browserSupport?.browserslist;
|
|
76
|
-
const postCssPlugins = browserSupport?.postCss?.plugins;
|
|
77
|
-
const legacyModule = browserSupport?.legacyModule === true;
|
|
78
|
-
|
|
79
|
-
// browserslist → esbuild target
|
|
80
|
-
let esbuildTarget: string | string[] = "es2022";
|
|
81
|
-
if (browserslist != null) {
|
|
82
|
-
const queries = Array.isArray(browserslist)
|
|
83
|
-
? browserslist
|
|
84
|
-
: [browserslist];
|
|
85
|
-
esbuildTarget = browserslistToEsbuild(queries);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// define: 환경변수 주입 (import.meta.env.KEY → Vite가 bare import.meta.env 객체를 자동 구성)
|
|
89
|
-
const define: Record<string, string> = {};
|
|
90
|
-
if (options.env != null) {
|
|
91
|
-
for (const [key, value] of Object.entries(options.env)) {
|
|
92
|
-
define[`import.meta.env.${key}`] = JSON.stringify(value);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// plugins
|
|
97
|
-
const plugins: PluginOption[] = [
|
|
98
|
-
tsconfigPaths(),
|
|
99
|
-
];
|
|
100
|
-
|
|
101
|
-
if (options.framework === "solid") {
|
|
102
|
-
plugins.push(solidPlugin());
|
|
103
|
-
} else {
|
|
104
|
-
plugins.push(
|
|
105
|
-
sdAngularPlugin({
|
|
106
|
-
pkg: name,
|
|
107
|
-
onBuildStart: options.onBuildStart,
|
|
108
|
-
onBuild: options.onBuild,
|
|
109
|
-
}),
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
// PostCSS inline plugin (Angular @Component inline styles 전용)
|
|
113
|
-
if (postCssPlugins != null && postCssPlugins.length > 0) {
|
|
114
|
-
plugins.push(
|
|
115
|
-
sdPostCssInlinePlugin({ postCssPlugins: postCssPlugins }),
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// replaceDeps HMR (dev 모드 또는 watch 모드)
|
|
121
|
-
if (
|
|
122
|
-
(options.mode === "dev" || options.watch === true) &&
|
|
123
|
-
options.replaceDeps != null &&
|
|
124
|
-
options.replaceDeps.length > 0
|
|
125
|
-
) {
|
|
126
|
-
plugins.push(
|
|
127
|
-
sdScopeWatchPlugin({
|
|
128
|
-
pkgDir: options.pkgDir,
|
|
129
|
-
replaceDeps: options.replaceDeps,
|
|
130
|
-
onScopeRebuild: options.onScopeRebuild,
|
|
131
|
-
}),
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// server 설정 (dev 모드만)
|
|
136
|
-
const serverConfig =
|
|
137
|
-
options.mode === "dev"
|
|
138
|
-
? {
|
|
139
|
-
host: options.serverPort === 0 ? "127.0.0.1" : "0.0.0.0",
|
|
140
|
-
port: options.serverPort === 0 ? undefined : options.serverPort,
|
|
141
|
-
strictPort: options.serverPort !== 0,
|
|
142
|
-
}
|
|
143
|
-
: undefined;
|
|
144
|
-
|
|
145
|
-
// css.postcss 설정 (외부 .css/.scss 파일용)
|
|
146
|
-
const cssConfig =
|
|
147
|
-
postCssPlugins != null && postCssPlugins.length > 0
|
|
148
|
-
? { postcss: { plugins: postCssPlugins as import("postcss").AcceptedPlugin[] } }
|
|
149
|
-
: undefined;
|
|
150
|
-
|
|
151
|
-
// optimizeDeps.exclude (사용자 지정 exclude + replaceDeps 패키지)
|
|
152
|
-
const excludeList = [
|
|
153
|
-
...(options.exclude ?? []),
|
|
154
|
-
...(options.replaceDeps?.map((dep) => dep.packageName) ?? []),
|
|
155
|
-
];
|
|
156
|
-
const optimizeDepsConfig =
|
|
157
|
-
excludeList.length > 0 ? { exclude: excludeList } : undefined;
|
|
158
|
-
|
|
159
|
-
const config: InlineConfig = {
|
|
160
|
-
root: options.pkgDir,
|
|
161
|
-
base: options.base ?? `/${name}/`,
|
|
162
|
-
define: Object.keys(define).length > 0 ? define : undefined,
|
|
163
|
-
plugins,
|
|
164
|
-
server: serverConfig,
|
|
165
|
-
css: cssConfig,
|
|
166
|
-
esbuild: {
|
|
167
|
-
target: esbuildTarget,
|
|
168
|
-
},
|
|
169
|
-
build: {
|
|
170
|
-
target: esbuildTarget,
|
|
171
|
-
},
|
|
172
|
-
optimizeDeps: {
|
|
173
|
-
...optimizeDepsConfig,
|
|
174
|
-
esbuildOptions: {
|
|
175
|
-
target: esbuildTarget,
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
// PWA (build 모드 + pwa !== false)
|
|
181
|
-
if (options.mode === "build" && options.pwa !== false) {
|
|
182
|
-
const pwaConfig = typeof options.pwa === "object" ? options.pwa : {};
|
|
183
|
-
|
|
184
|
-
// 아이콘 자동 생성 (커스텀 icons 미설정 시)
|
|
185
|
-
let iconsConfig: Record<string, unknown> = {};
|
|
186
|
-
if (pwaConfig.manifest?.icons != null) {
|
|
187
|
-
iconsConfig = { icons: pwaConfig.manifest.icons };
|
|
188
|
-
} else {
|
|
189
|
-
const generatedIcons = await generatePwaIcons(options.pkgDir);
|
|
190
|
-
if (generatedIcons.length > 0) {
|
|
191
|
-
iconsConfig = { icons: generatedIcons };
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
const pwaManifest = {
|
|
196
|
-
name: pwaConfig.manifest?.name ?? name,
|
|
197
|
-
short_name: pwaConfig.manifest?.short_name ?? name,
|
|
198
|
-
display: pwaConfig.manifest?.display ?? "standalone",
|
|
199
|
-
theme_color: pwaConfig.manifest?.theme_color ?? "#ffffff",
|
|
200
|
-
background_color: pwaConfig.manifest?.background_color ?? "#ffffff",
|
|
201
|
-
...iconsConfig,
|
|
202
|
-
};
|
|
203
|
-
const pwaWorkbox = {
|
|
204
|
-
globPatterns: pwaConfig.workbox?.globPatterns ?? [
|
|
205
|
-
"**/*.{js,css,html,ico,png,svg,woff2}",
|
|
206
|
-
],
|
|
207
|
-
};
|
|
208
|
-
(config.plugins as PluginOption[]).push(
|
|
209
|
-
VitePWA({
|
|
210
|
-
registerType: "prompt",
|
|
211
|
-
injectRegister: "script",
|
|
212
|
-
manifest: pwaManifest,
|
|
213
|
-
workbox: pwaWorkbox,
|
|
214
|
-
}),
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// polyfills plugin
|
|
219
|
-
if (options.polyfills != null && options.polyfills.length > 0) {
|
|
220
|
-
const polyfillImports = options.polyfills;
|
|
221
|
-
if (legacyModule === true) {
|
|
222
|
-
// legacyModule: 메인 엔트리의 transform에서 polyfill import를 상단에 주입한다.
|
|
223
|
-
// transformIndexHtml의 인라인 <script type="module">은 Vite 빌드에서 번들링되지 않으므로,
|
|
224
|
-
// Rollup이 처리할 수 있도록 소스 코드 레벨에서 주입한다.
|
|
225
|
-
const mainEntryPath = path.resolve(options.pkgDir, "src/main.ts");
|
|
226
|
-
(config.plugins as PluginOption[]).push({
|
|
227
|
-
name: "sd-polyfills",
|
|
228
|
-
transform(code, id) {
|
|
229
|
-
if (path.normalize(id) !== path.normalize(mainEntryPath)) return null;
|
|
230
|
-
// polyfillImports는 pkgDir 기준 상대경로 (예: "./src/polyfills.ts")
|
|
231
|
-
// main.ts는 src/ 안에 있으므로, main.ts 기준 상대경로로 변환한다
|
|
232
|
-
const mainDir = path.dirname(mainEntryPath);
|
|
233
|
-
const polyfillCode = polyfillImports
|
|
234
|
-
.map((p) => {
|
|
235
|
-
const abs = path.resolve(options.pkgDir, p);
|
|
236
|
-
this.addWatchFile(abs);
|
|
237
|
-
const rel = path.relative(mainDir, abs);
|
|
238
|
-
const posixRel = rel.replace(/\\/g, "/");
|
|
239
|
-
return "import \"./" + posixRel + "\";";
|
|
240
|
-
})
|
|
241
|
-
.join("\n");
|
|
242
|
-
return { code: polyfillCode + "\n" + code, map: null };
|
|
243
|
-
},
|
|
244
|
-
});
|
|
245
|
-
} else {
|
|
246
|
-
// dev 모드: transformIndexHtml로 인라인 스크립트 주입 (Vite dev server가 처리)
|
|
247
|
-
(config.plugins as PluginOption[]).push({
|
|
248
|
-
name: "sd-polyfills",
|
|
249
|
-
transformIndexHtml() {
|
|
250
|
-
return [
|
|
251
|
-
{
|
|
252
|
-
tag: "script",
|
|
253
|
-
attrs: { type: "module" },
|
|
254
|
-
children: polyfillImports.map((p) => `import "${p}";`).join("\n"),
|
|
255
|
-
injectTo: "head-prepend" as const,
|
|
256
|
-
},
|
|
257
|
-
];
|
|
258
|
-
},
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
// legacyModule: true → 코드 스플리팅 비활성화 + esbuild import.meta 변환 + 잔여 import() 제거
|
|
264
|
-
if (legacyModule === true) {
|
|
265
|
-
config.esbuild = {
|
|
266
|
-
...config.esbuild,
|
|
267
|
-
supported: {
|
|
268
|
-
"import-meta": false,
|
|
269
|
-
},
|
|
270
|
-
};
|
|
271
|
-
config.build = {
|
|
272
|
-
...config.build,
|
|
273
|
-
rollupOptions: {
|
|
274
|
-
output: {
|
|
275
|
-
inlineDynamicImports: true,
|
|
276
|
-
},
|
|
277
|
-
},
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
// Rollup이 인라인하지 못한 잔여 dynamic import()를 제거한다.
|
|
281
|
-
// inlineDynamicImports가 정적 경로를 모두 인라인한 후에도,
|
|
282
|
-
// @vite-ignore나 런타임 계산 경로의 import()가 남을 수 있다.
|
|
283
|
-
// Chrome 61은 import() 구문을 파싱하지 못하므로 no-op 함수로 치환한다.
|
|
284
|
-
(config.plugins as PluginOption[]).push({
|
|
285
|
-
name: "sd-legacy-strip-dynamic-import",
|
|
286
|
-
enforce: "post",
|
|
287
|
-
renderChunk(code) {
|
|
288
|
-
if (!code.includes("import(")) return null;
|
|
289
|
-
return {
|
|
290
|
-
code: code.replace(
|
|
291
|
-
/\bimport\s*\(/g,
|
|
292
|
-
"(function(){return Promise.reject(new Error(\"Dynamic import not supported\"))})(",
|
|
293
|
-
),
|
|
294
|
-
map: null,
|
|
295
|
-
};
|
|
296
|
-
},
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// build 모드 설정 (프로덕션 빌드 또는 legacyModule dev)
|
|
301
|
-
if (options.mode === "build" || legacyModule === true) {
|
|
302
|
-
config.build = {
|
|
303
|
-
...config.build,
|
|
304
|
-
outDir: options.outDir ?? path.join(options.pkgDir, "dist"),
|
|
305
|
-
};
|
|
306
|
-
if (options.watch === true) {
|
|
307
|
-
config.build.watch = {};
|
|
308
|
-
config.build.emptyOutDir = false;
|
|
309
|
-
config.build.minify = false;
|
|
310
|
-
config.build.sourcemap = true;
|
|
311
|
-
} else {
|
|
312
|
-
config.logLevel = "silent";
|
|
313
|
-
config.build.emptyOutDir = true;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
return config;
|
|
318
|
-
}
|