@simplysm/sd-cli 14.0.29 → 14.0.32
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,401 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
2
|
-
import type { Plugin } from "vite";
|
|
3
|
-
import fs from "node:fs";
|
|
4
|
-
|
|
5
|
-
// --- Mock factories ---
|
|
6
|
-
|
|
7
|
-
const mockGeneratePwaIcons = vi.fn();
|
|
8
|
-
vi.mock("../../src/utils/generate-pwa-icons.js", () => ({
|
|
9
|
-
generatePwaIcons: mockGeneratePwaIcons,
|
|
10
|
-
}));
|
|
11
|
-
|
|
12
|
-
const mockGlob = vi.fn();
|
|
13
|
-
vi.mock("glob", () => ({
|
|
14
|
-
glob: mockGlob,
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
|
-
// --- Dynamic import ---
|
|
18
|
-
|
|
19
|
-
const { sdPwaPlugin } = await import("../../src/utils/vite-pwa-plugin");
|
|
20
|
-
|
|
21
|
-
// --- Helpers ---
|
|
22
|
-
|
|
23
|
-
function createPlugin(
|
|
24
|
-
overrides?: Partial<Parameters<typeof sdPwaPlugin>[0]>,
|
|
25
|
-
): Plugin {
|
|
26
|
-
return sdPwaPlugin({
|
|
27
|
-
pkgDir: "/packages/test-app",
|
|
28
|
-
pkgName: "test-app",
|
|
29
|
-
...overrides,
|
|
30
|
-
}) as Plugin;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function initPlugin(plugin: Plugin): void {
|
|
34
|
-
(plugin.configResolved as Function)({
|
|
35
|
-
base: "/test-app/",
|
|
36
|
-
build: { outDir: "/packages/test-app/dist" },
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function getWriteCall(filename: string): [string, string] | undefined {
|
|
41
|
-
return vi.mocked(fs.writeFileSync).mock.calls.find((c) =>
|
|
42
|
-
String(c[0]).endsWith(filename),
|
|
43
|
-
) as [string, string] | undefined;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// --- Tests ---
|
|
47
|
-
|
|
48
|
-
beforeEach(() => {
|
|
49
|
-
vi.clearAllMocks();
|
|
50
|
-
mockGeneratePwaIcons.mockResolvedValue([]);
|
|
51
|
-
mockGlob.mockResolvedValue([]);
|
|
52
|
-
vi.spyOn(fs, "readFileSync").mockReturnValue(
|
|
53
|
-
JSON.stringify({ version: "1.0.0" }),
|
|
54
|
-
);
|
|
55
|
-
vi.spyOn(fs, "writeFileSync").mockReturnValue(undefined);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
afterEach(() => {
|
|
59
|
-
vi.restoreAllMocks();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
describe("sdPwaPlugin — manifest generation", () => {
|
|
63
|
-
// Unit: pwa undefined uses same defaults as empty object
|
|
64
|
-
it("uses defaults when pwa is undefined", async () => {
|
|
65
|
-
const plugin = createPlugin({ pwa: undefined });
|
|
66
|
-
initPlugin(plugin);
|
|
67
|
-
await (plugin.closeBundle as Function)();
|
|
68
|
-
|
|
69
|
-
const call = getWriteCall("manifest.webmanifest");
|
|
70
|
-
expect(call).toBeDefined();
|
|
71
|
-
const manifest = JSON.parse(call![1]) as Record<string, unknown>;
|
|
72
|
-
expect(manifest["name"]).toBe("test-app");
|
|
73
|
-
expect(manifest["scope"]).toBe(".");
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// Unit: manifest written to correct outDir path
|
|
77
|
-
it("writes manifest to resolvedOutDir", async () => {
|
|
78
|
-
const plugin = createPlugin();
|
|
79
|
-
initPlugin(plugin);
|
|
80
|
-
await (plugin.closeBundle as Function)();
|
|
81
|
-
|
|
82
|
-
const call = getWriteCall("manifest.webmanifest");
|
|
83
|
-
const writtenPath = String(call![0]).replace(/\\/g, "/");
|
|
84
|
-
expect(writtenPath).toContain("packages/test-app/dist");
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
// Unit: generated icons included in manifest
|
|
88
|
-
it("includes generated icons in manifest when no custom icons", async () => {
|
|
89
|
-
mockGeneratePwaIcons.mockResolvedValue([
|
|
90
|
-
{ src: "icons/icon-192x192.png", sizes: "192x192", type: "image/png" },
|
|
91
|
-
]);
|
|
92
|
-
|
|
93
|
-
const plugin = createPlugin();
|
|
94
|
-
initPlugin(plugin);
|
|
95
|
-
await (plugin.closeBundle as Function)();
|
|
96
|
-
|
|
97
|
-
expect(mockGeneratePwaIcons).toHaveBeenCalledWith("/packages/test-app");
|
|
98
|
-
const manifest = JSON.parse(getWriteCall("manifest.webmanifest")![1]) as Record<
|
|
99
|
-
string,
|
|
100
|
-
unknown
|
|
101
|
-
>;
|
|
102
|
-
expect(manifest["icons"]).toEqual([
|
|
103
|
-
{ src: "icons/icon-192x192.png", sizes: "192x192", type: "image/png" },
|
|
104
|
-
]);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// Unit: custom icons skip auto-generation
|
|
108
|
-
it("uses custom icons and skips generatePwaIcons", async () => {
|
|
109
|
-
const icons = [{ src: "/custom.png", sizes: "512x512", type: "image/png" }];
|
|
110
|
-
const plugin = createPlugin({
|
|
111
|
-
pwa: { manifest: { icons } },
|
|
112
|
-
});
|
|
113
|
-
initPlugin(plugin);
|
|
114
|
-
await (plugin.closeBundle as Function)();
|
|
115
|
-
|
|
116
|
-
const manifest = JSON.parse(getWriteCall("manifest.webmanifest")![1]) as Record<
|
|
117
|
-
string,
|
|
118
|
-
unknown
|
|
119
|
-
>;
|
|
120
|
-
expect(manifest["icons"]).toEqual(icons);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
// Unit: no icons when generatePwaIcons returns empty
|
|
124
|
-
it("omits icons field when generatePwaIcons returns empty array", async () => {
|
|
125
|
-
mockGeneratePwaIcons.mockResolvedValue([]);
|
|
126
|
-
|
|
127
|
-
const plugin = createPlugin();
|
|
128
|
-
initPlugin(plugin);
|
|
129
|
-
await (plugin.closeBundle as Function)();
|
|
130
|
-
|
|
131
|
-
const manifest = JSON.parse(getWriteCall("manifest.webmanifest")![1]) as Record<
|
|
132
|
-
string,
|
|
133
|
-
unknown
|
|
134
|
-
>;
|
|
135
|
-
expect(manifest["icons"]).toBeUndefined();
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
// Unit: all manifest fields can be overridden
|
|
139
|
-
it("overrides all customizable manifest fields", async () => {
|
|
140
|
-
const plugin = createPlugin({
|
|
141
|
-
pwa: {
|
|
142
|
-
manifest: {
|
|
143
|
-
name: "A",
|
|
144
|
-
short_name: "B",
|
|
145
|
-
display: "fullscreen",
|
|
146
|
-
theme_color: "#111",
|
|
147
|
-
background_color: "#222",
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
initPlugin(plugin);
|
|
152
|
-
await (plugin.closeBundle as Function)();
|
|
153
|
-
|
|
154
|
-
const manifest = JSON.parse(getWriteCall("manifest.webmanifest")![1]) as Record<
|
|
155
|
-
string,
|
|
156
|
-
unknown
|
|
157
|
-
>;
|
|
158
|
-
expect(manifest["name"]).toBe("A");
|
|
159
|
-
expect(manifest["short_name"]).toBe("B");
|
|
160
|
-
expect(manifest["display"]).toBe("fullscreen");
|
|
161
|
-
expect(manifest["theme_color"]).toBe("#111");
|
|
162
|
-
expect(manifest["background_color"]).toBe("#222");
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
describe("sdPwaPlugin — precache file collection", () => {
|
|
167
|
-
// Unit: default globPatterns
|
|
168
|
-
it("uses default globPatterns when workbox is not configured", async () => {
|
|
169
|
-
mockGlob.mockResolvedValue(["index.html", "assets/main.js"]);
|
|
170
|
-
|
|
171
|
-
const plugin = createPlugin();
|
|
172
|
-
initPlugin(plugin);
|
|
173
|
-
await (plugin.closeBundle as Function)();
|
|
174
|
-
|
|
175
|
-
expect(mockGlob).toHaveBeenCalledWith(
|
|
176
|
-
"**/*.{js,css,html,ico,png,svg,woff2}",
|
|
177
|
-
{ cwd: "/packages/test-app/dist" },
|
|
178
|
-
);
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
// Unit: custom globPatterns
|
|
182
|
-
it("uses custom globPatterns from workbox config", async () => {
|
|
183
|
-
mockGlob.mockResolvedValue(["index.html"]);
|
|
184
|
-
|
|
185
|
-
const plugin = createPlugin({
|
|
186
|
-
pwa: { workbox: { globPatterns: ["**/*.{js,html}"] } },
|
|
187
|
-
});
|
|
188
|
-
initPlugin(plugin);
|
|
189
|
-
await (plugin.closeBundle as Function)();
|
|
190
|
-
|
|
191
|
-
expect(mockGlob).toHaveBeenCalledWith("**/*.{js,html}", expect.anything());
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
// Unit: excludes sw.js and manifest.webmanifest from precache
|
|
195
|
-
it("excludes sw.js and manifest.webmanifest from precache list", async () => {
|
|
196
|
-
mockGlob.mockResolvedValue([
|
|
197
|
-
"index.html",
|
|
198
|
-
"main.js",
|
|
199
|
-
"sw.js",
|
|
200
|
-
"manifest.webmanifest",
|
|
201
|
-
]);
|
|
202
|
-
|
|
203
|
-
const plugin = createPlugin();
|
|
204
|
-
initPlugin(plugin);
|
|
205
|
-
await (plugin.closeBundle as Function)();
|
|
206
|
-
|
|
207
|
-
const swCall = getWriteCall("sw.js");
|
|
208
|
-
const swContent = swCall![1];
|
|
209
|
-
expect(swContent).toContain('"index.html"');
|
|
210
|
-
expect(swContent).toContain('"main.js"');
|
|
211
|
-
expect(swContent).not.toMatch(/"sw\.js"/);
|
|
212
|
-
expect(swContent).not.toMatch(/"manifest\.webmanifest"/);
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
// Unit: deduplicates file list
|
|
216
|
-
it("deduplicates files matched by multiple patterns", async () => {
|
|
217
|
-
mockGlob
|
|
218
|
-
.mockResolvedValueOnce(["index.html", "main.js"])
|
|
219
|
-
.mockResolvedValueOnce(["index.html", "styles.css"]);
|
|
220
|
-
|
|
221
|
-
const plugin = createPlugin({
|
|
222
|
-
pwa: {
|
|
223
|
-
workbox: { globPatterns: ["**/*.{html,js}", "**/*.{html,css}"] },
|
|
224
|
-
},
|
|
225
|
-
});
|
|
226
|
-
initPlugin(plugin);
|
|
227
|
-
await (plugin.closeBundle as Function)();
|
|
228
|
-
|
|
229
|
-
const swContent = getWriteCall("sw.js")![1];
|
|
230
|
-
// Extract only the PRECACHE_URLS array declaration
|
|
231
|
-
const precacheMatch = swContent.match(
|
|
232
|
-
/const PRECACHE_URLS = \[([\s\S]*?)\];/,
|
|
233
|
-
);
|
|
234
|
-
expect(precacheMatch).toBeDefined();
|
|
235
|
-
const precacheBlock = precacheMatch![1];
|
|
236
|
-
const htmlMatches = precacheBlock.match(/"index\.html"/g);
|
|
237
|
-
expect(htmlMatches).toHaveLength(1);
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
describe("sdPwaPlugin — sw.js generation", () => {
|
|
242
|
-
// Unit: version injected from package.json
|
|
243
|
-
it("injects APP_VERSION from package.json", async () => {
|
|
244
|
-
vi.mocked(fs.readFileSync).mockReturnValue(
|
|
245
|
-
JSON.stringify({ version: "14.0.16" }),
|
|
246
|
-
);
|
|
247
|
-
|
|
248
|
-
const plugin = createPlugin();
|
|
249
|
-
initPlugin(plugin);
|
|
250
|
-
await (plugin.closeBundle as Function)();
|
|
251
|
-
|
|
252
|
-
const swContent = getWriteCall("sw.js")![1];
|
|
253
|
-
expect(swContent).toContain('const APP_VERSION = "14.0.16"');
|
|
254
|
-
expect(swContent).toContain('"precache-" + APP_VERSION');
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
// Unit: base URL injected
|
|
258
|
-
it("injects BASE_URL from resolved config", async () => {
|
|
259
|
-
const plugin = createPlugin();
|
|
260
|
-
initPlugin(plugin);
|
|
261
|
-
await (plugin.closeBundle as Function)();
|
|
262
|
-
|
|
263
|
-
const swContent = getWriteCall("sw.js")![1];
|
|
264
|
-
expect(swContent).toContain('const BASE_URL = "/test-app/"');
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
// Unit: sw.js contains all 4 event listeners
|
|
268
|
-
it("contains install, activate, fetch, and message event listeners", async () => {
|
|
269
|
-
const plugin = createPlugin();
|
|
270
|
-
initPlugin(plugin);
|
|
271
|
-
await (plugin.closeBundle as Function)();
|
|
272
|
-
|
|
273
|
-
const swContent = getWriteCall("sw.js")![1];
|
|
274
|
-
expect(swContent).toContain('self.addEventListener("install"');
|
|
275
|
-
expect(swContent).toContain('self.addEventListener("activate"');
|
|
276
|
-
expect(swContent).toContain('self.addEventListener("fetch"');
|
|
277
|
-
expect(swContent).toContain('self.addEventListener("message"');
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
// Unit: install handler uses cache.addAll
|
|
281
|
-
it("install handler caches all precache URLs", async () => {
|
|
282
|
-
const plugin = createPlugin();
|
|
283
|
-
initPlugin(plugin);
|
|
284
|
-
await (plugin.closeBundle as Function)();
|
|
285
|
-
|
|
286
|
-
const swContent = getWriteCall("sw.js")![1];
|
|
287
|
-
expect(swContent).toContain("caches.open(CACHE_NAME)");
|
|
288
|
-
expect(swContent).toContain("cache.addAll(PRECACHE_URLS)");
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
// Unit: activate handler deletes old caches with precache- prefix only
|
|
292
|
-
it("activate handler filters by precache- prefix", async () => {
|
|
293
|
-
const plugin = createPlugin();
|
|
294
|
-
initPlugin(plugin);
|
|
295
|
-
await (plugin.closeBundle as Function)();
|
|
296
|
-
|
|
297
|
-
const swContent = getWriteCall("sw.js")![1];
|
|
298
|
-
expect(swContent).toContain('name.startsWith("precache-")');
|
|
299
|
-
expect(swContent).toContain("name !== CACHE_NAME");
|
|
300
|
-
expect(swContent).toContain("self.clients.claim()");
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
// Unit: fetch handler has navigate fallback to index.html with network fallback
|
|
304
|
-
it("fetch handler falls back to index.html for navigate requests with network fallback", async () => {
|
|
305
|
-
const plugin = createPlugin();
|
|
306
|
-
initPlugin(plugin);
|
|
307
|
-
await (plugin.closeBundle as Function)();
|
|
308
|
-
|
|
309
|
-
const swContent = getWriteCall("sw.js")![1];
|
|
310
|
-
expect(swContent).toContain('event.request.mode === "navigate"');
|
|
311
|
-
expect(swContent).toContain('BASE_URL + "index.html"');
|
|
312
|
-
// Network fallback when index.html is not in cache (storage pressure)
|
|
313
|
-
expect(swContent).toContain("resp || fetch(event.request)");
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
// Unit: message handler responds to SKIP_WAITING
|
|
317
|
-
it("message handler calls self.skipWaiting on SKIP_WAITING", async () => {
|
|
318
|
-
const plugin = createPlugin();
|
|
319
|
-
initPlugin(plugin);
|
|
320
|
-
await (plugin.closeBundle as Function)();
|
|
321
|
-
|
|
322
|
-
const swContent = getWriteCall("sw.js")![1];
|
|
323
|
-
expect(swContent).toContain('"SKIP_WAITING"');
|
|
324
|
-
expect(swContent).toContain("self.skipWaiting()");
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
// Unit: backslash normalization in file paths
|
|
328
|
-
it("normalizes backslashes in precache URLs", async () => {
|
|
329
|
-
mockGlob.mockResolvedValue(["assets\\main.js"]);
|
|
330
|
-
|
|
331
|
-
const plugin = createPlugin();
|
|
332
|
-
initPlugin(plugin);
|
|
333
|
-
await (plugin.closeBundle as Function)();
|
|
334
|
-
|
|
335
|
-
const swContent = getWriteCall("sw.js")![1];
|
|
336
|
-
expect(swContent).toContain('"assets/main.js"');
|
|
337
|
-
expect(swContent).not.toContain("\\\\");
|
|
338
|
-
});
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
describe("sdPwaPlugin — transformIndexHtml", () => {
|
|
342
|
-
// Unit: manifest link tag
|
|
343
|
-
it("injects manifest link tag", () => {
|
|
344
|
-
const plugin = createPlugin();
|
|
345
|
-
initPlugin(plugin);
|
|
346
|
-
const tags = (plugin.transformIndexHtml as Function)() as Array<{
|
|
347
|
-
tag: string;
|
|
348
|
-
attrs?: Record<string, string>;
|
|
349
|
-
injectTo?: string;
|
|
350
|
-
}>;
|
|
351
|
-
|
|
352
|
-
const linkTag = tags.find((t) => t.tag === "link");
|
|
353
|
-
expect(linkTag).toBeDefined();
|
|
354
|
-
expect(linkTag!.attrs!["rel"]).toBe("manifest");
|
|
355
|
-
expect(linkTag!.attrs!["href"]).toBe("manifest.webmanifest");
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
// Unit: SW registration script tag
|
|
359
|
-
it("injects SW registration script", () => {
|
|
360
|
-
const plugin = createPlugin();
|
|
361
|
-
initPlugin(plugin);
|
|
362
|
-
const tags = (plugin.transformIndexHtml as Function)() as Array<{
|
|
363
|
-
tag: string;
|
|
364
|
-
children?: string;
|
|
365
|
-
injectTo?: string;
|
|
366
|
-
}>;
|
|
367
|
-
|
|
368
|
-
const scriptTag = tags.find((t) => t.tag === "script");
|
|
369
|
-
expect(scriptTag).toBeDefined();
|
|
370
|
-
expect(scriptTag!.children).toContain("serviceWorker");
|
|
371
|
-
expect(scriptTag!.children).toContain('register("sw.js")');
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
// Unit: registration script dispatches sd-pwa-update-ready event
|
|
375
|
-
it("dispatches sd-pwa-update-ready CustomEvent", () => {
|
|
376
|
-
const plugin = createPlugin();
|
|
377
|
-
initPlugin(plugin);
|
|
378
|
-
const tags = (plugin.transformIndexHtml as Function)() as Array<{
|
|
379
|
-
tag: string;
|
|
380
|
-
children?: string;
|
|
381
|
-
}>;
|
|
382
|
-
|
|
383
|
-
const scriptTag = tags.find((t) => t.tag === "script");
|
|
384
|
-
expect(scriptTag!.children).toContain("sd-pwa-update-ready");
|
|
385
|
-
expect(scriptTag!.children).toContain("SKIP_WAITING");
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
// Unit: registration script reloads on controllerchange
|
|
389
|
-
it("reloads page on controllerchange", () => {
|
|
390
|
-
const plugin = createPlugin();
|
|
391
|
-
initPlugin(plugin);
|
|
392
|
-
const tags = (plugin.transformIndexHtml as Function)() as Array<{
|
|
393
|
-
tag: string;
|
|
394
|
-
children?: string;
|
|
395
|
-
}>;
|
|
396
|
-
|
|
397
|
-
const scriptTag = tags.find((t) => t.tag === "script");
|
|
398
|
-
expect(scriptTag!.children).toContain("controllerchange");
|
|
399
|
-
expect(scriptTag!.children).toContain("location.reload");
|
|
400
|
-
});
|
|
401
|
-
});
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, afterEach } from "vitest";
|
|
2
|
-
|
|
3
|
-
// --- Mock factories ---
|
|
4
|
-
|
|
5
|
-
const mockWatcher = {
|
|
6
|
-
onChange: vi.fn(),
|
|
7
|
-
close: vi.fn().mockResolvedValue(undefined),
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
vi.mock("@simplysm/core-node", () => ({
|
|
11
|
-
FsWatcher: {
|
|
12
|
-
watch: vi.fn(() => Promise.resolve(mockWatcher)),
|
|
13
|
-
},
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
vi.mock("fs", () => ({
|
|
17
|
-
default: {
|
|
18
|
-
existsSync: vi.fn(() => true),
|
|
19
|
-
realpathSync: vi.fn((p: string) => p.replace("/symlink/", "/real/")),
|
|
20
|
-
},
|
|
21
|
-
}));
|
|
22
|
-
|
|
23
|
-
// --- Dynamic import after mocking ---
|
|
24
|
-
|
|
25
|
-
const { sdScopeWatchPlugin } = await import(
|
|
26
|
-
"../../src/utils/vite-scope-watch-plugin"
|
|
27
|
-
);
|
|
28
|
-
const { FsWatcher } = await import("@simplysm/core-node");
|
|
29
|
-
|
|
30
|
-
afterEach(() => {
|
|
31
|
-
vi.clearAllMocks();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe("sdScopeWatchPlugin", () => {
|
|
35
|
-
// Acceptance: Scenario "replaceDeps 패키지는 Vite pre-bundling에서 제외된다"
|
|
36
|
-
it("adds replaceDeps packages to optimizeDeps.exclude", () => {
|
|
37
|
-
const plugin = sdScopeWatchPlugin({
|
|
38
|
-
pkgDir: "/packages/my-client",
|
|
39
|
-
replaceDeps: [
|
|
40
|
-
{ packageName: "@scope/core", sourcePath: "/packages/core" },
|
|
41
|
-
{ packageName: "@scope/common", sourcePath: "/packages/common" },
|
|
42
|
-
],
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const config = (plugin as any).config?.();
|
|
46
|
-
|
|
47
|
-
expect(config?.optimizeDeps?.exclude).toContain("@scope/core");
|
|
48
|
-
expect(config?.optimizeDeps?.exclude).toContain("@scope/common");
|
|
49
|
-
expect(config?.optimizeDeps?.force).toBe(true);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// Acceptance: Scenario "라이브러리 재빌드로 의존성 변경"
|
|
53
|
-
it("configureServer sets up FsWatcher on replaceDeps package root directories", async () => {
|
|
54
|
-
const onScopeRebuild = vi.fn();
|
|
55
|
-
|
|
56
|
-
const plugin = sdScopeWatchPlugin({
|
|
57
|
-
pkgDir: "/packages/my-client",
|
|
58
|
-
replaceDeps: [
|
|
59
|
-
{ packageName: "@scope/core", sourcePath: "/packages/core" },
|
|
60
|
-
],
|
|
61
|
-
onScopeRebuild,
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const mockServer = {
|
|
65
|
-
watcher: { emit: vi.fn() },
|
|
66
|
-
httpServer: { on: vi.fn() },
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
await (plugin as any).configureServer?.(mockServer);
|
|
70
|
-
|
|
71
|
-
expect(FsWatcher.watch).toHaveBeenCalled();
|
|
72
|
-
// 패키지 루트를 감시해야 한다 (dist/가 아닌)
|
|
73
|
-
const watchedPaths = (FsWatcher.watch as ReturnType<typeof vi.fn>).mock.calls[0][0] as string[];
|
|
74
|
-
const normalizedPaths = watchedPaths.map((p: string) => p.replace(/\\/g, "/"));
|
|
75
|
-
expect(normalizedPaths.some((p: string) => p.endsWith("/@scope/core"))).toBe(true);
|
|
76
|
-
expect(normalizedPaths.some((p: string) => p.endsWith("/@scope/core/dist"))).toBe(false);
|
|
77
|
-
expect(mockWatcher.onChange).toHaveBeenCalledWith(
|
|
78
|
-
expect.objectContaining({ delay: 300 }),
|
|
79
|
-
expect.any(Function),
|
|
80
|
-
);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// Acceptance: Scenario "SCSS 파일 변경 시 Vite change 이벤트 발생"
|
|
84
|
-
it("onChange callback emits change events for scss file changes", async () => {
|
|
85
|
-
const onScopeRebuild = vi.fn();
|
|
86
|
-
|
|
87
|
-
const plugin = sdScopeWatchPlugin({
|
|
88
|
-
pkgDir: "/packages/my-client",
|
|
89
|
-
replaceDeps: [
|
|
90
|
-
{ packageName: "@scope/core", sourcePath: "/packages/core" },
|
|
91
|
-
],
|
|
92
|
-
onScopeRebuild,
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
const mockServer = {
|
|
96
|
-
watcher: { emit: vi.fn() },
|
|
97
|
-
httpServer: { on: vi.fn() },
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
await (plugin as any).configureServer?.(mockServer);
|
|
101
|
-
|
|
102
|
-
const onChangeCallback = mockWatcher.onChange.mock.calls[0][1];
|
|
103
|
-
|
|
104
|
-
// SCSS 파일 변경 시뮬레이션
|
|
105
|
-
onChangeCallback([
|
|
106
|
-
{ path: "/packages/core/scss/commons/_styles.scss" },
|
|
107
|
-
]);
|
|
108
|
-
|
|
109
|
-
expect(mockServer.watcher.emit).toHaveBeenCalledWith(
|
|
110
|
-
"change",
|
|
111
|
-
"/packages/core/scss/commons/_styles.scss",
|
|
112
|
-
);
|
|
113
|
-
expect(onScopeRebuild).toHaveBeenCalled();
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// Acceptance: Scenario "여러 라이브러리 파일 동시 변경 시 디바운스"
|
|
117
|
-
it("onChange callback emits change events and calls onScopeRebuild", async () => {
|
|
118
|
-
const onScopeRebuild = vi.fn();
|
|
119
|
-
|
|
120
|
-
const plugin = sdScopeWatchPlugin({
|
|
121
|
-
pkgDir: "/packages/my-client",
|
|
122
|
-
replaceDeps: [
|
|
123
|
-
{ packageName: "@scope/core", sourcePath: "/packages/core" },
|
|
124
|
-
],
|
|
125
|
-
onScopeRebuild,
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
const mockServer = {
|
|
129
|
-
watcher: { emit: vi.fn() },
|
|
130
|
-
httpServer: { on: vi.fn() },
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
await (plugin as any).configureServer?.(mockServer);
|
|
134
|
-
|
|
135
|
-
// Get the onChange callback
|
|
136
|
-
const onChangeCallback = mockWatcher.onChange.mock.calls[0][1];
|
|
137
|
-
|
|
138
|
-
// Simulate file changes
|
|
139
|
-
onChangeCallback([
|
|
140
|
-
{ path: "/packages/core/dist/index.js" },
|
|
141
|
-
{ path: "/packages/core/dist/utils.js" },
|
|
142
|
-
]);
|
|
143
|
-
|
|
144
|
-
// Should emit change events to Vite watcher
|
|
145
|
-
expect(mockServer.watcher.emit).toHaveBeenCalledWith(
|
|
146
|
-
"change",
|
|
147
|
-
"/packages/core/dist/index.js",
|
|
148
|
-
);
|
|
149
|
-
expect(mockServer.watcher.emit).toHaveBeenCalledWith(
|
|
150
|
-
"change",
|
|
151
|
-
"/packages/core/dist/utils.js",
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
// Should call onScopeRebuild
|
|
155
|
-
expect(onScopeRebuild).toHaveBeenCalled();
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
// Acceptance: Scenario "replaceDeps가 없는 Client 패키지"
|
|
159
|
-
it("does nothing when replaceDeps is empty", async () => {
|
|
160
|
-
const plugin = sdScopeWatchPlugin({
|
|
161
|
-
pkgDir: "/packages/my-client",
|
|
162
|
-
replaceDeps: [],
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
const mockServer = {
|
|
166
|
-
watcher: { emit: vi.fn() },
|
|
167
|
-
httpServer: { on: vi.fn() },
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
await (plugin as any).configureServer?.(mockServer);
|
|
171
|
-
|
|
172
|
-
expect(FsWatcher.watch).not.toHaveBeenCalled();
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
// Scenario: symlink 경로를 realpath로 해결하여 감시한다
|
|
176
|
-
it("resolves symlink paths to realpath for watch directories", async () => {
|
|
177
|
-
const plugin = sdScopeWatchPlugin({
|
|
178
|
-
pkgDir: "/packages/my-client",
|
|
179
|
-
replaceDeps: [
|
|
180
|
-
{ packageName: "@scope/core", sourcePath: "/packages/core" },
|
|
181
|
-
],
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
const mockServer = {
|
|
185
|
-
watcher: { emit: vi.fn() },
|
|
186
|
-
httpServer: { on: vi.fn() },
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
await (plugin as any).configureServer?.(mockServer);
|
|
190
|
-
|
|
191
|
-
// fs.realpathSync가 패키지 루트 경로에 대해 호출되었는지 확인
|
|
192
|
-
const fsModule = (await import("fs")).default;
|
|
193
|
-
expect(fsModule.realpathSync).toHaveBeenCalled();
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
// Unit: server close cleans up watcher
|
|
197
|
-
it("registers cleanup on server httpServer close", async () => {
|
|
198
|
-
const plugin = sdScopeWatchPlugin({
|
|
199
|
-
pkgDir: "/packages/my-client",
|
|
200
|
-
replaceDeps: [
|
|
201
|
-
{ packageName: "@scope/core", sourcePath: "/packages/core" },
|
|
202
|
-
],
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
const closeHandler = vi.fn();
|
|
206
|
-
const mockServer = {
|
|
207
|
-
watcher: { emit: vi.fn() },
|
|
208
|
-
httpServer: { on: vi.fn((event: string, cb: () => void) => { if (event === "close") closeHandler.mockImplementation(cb); }) },
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
await (plugin as any).configureServer?.(mockServer);
|
|
212
|
-
|
|
213
|
-
// Trigger close
|
|
214
|
-
closeHandler();
|
|
215
|
-
|
|
216
|
-
expect(mockWatcher.close).toHaveBeenCalled();
|
|
217
|
-
});
|
|
218
|
-
});
|