feat(TypedServer): Enhance file watching with glob pattern for recursive directory matching

This commit is contained in:
2025-12-04 11:22:04 +00:00
parent 4dc0cb311b
commit 30126f716e

View File

@@ -271,7 +271,11 @@ export class TypedServer {
// Setup file watching
if (this.options.watch && this.options.serveDir) {
try {
this.smartwatchInstance = new plugins.smartwatch.Smartwatch([this.options.serveDir]);
// Use glob pattern to match all files recursively in serveDir
const watchGlob = this.options.serveDir.endsWith('/')
? `${this.options.serveDir}**/*`
: `${this.options.serveDir}/**/*`;
this.smartwatchInstance = new plugins.smartwatch.Smartwatch([watchGlob]);
await this.smartwatchInstance.start();
(await this.smartwatchInstance.getObservableFor('change')).subscribe(async () => {
await this.createServeDirHash();