This commit is contained in:
2026-07-20 11:15:46 +08:00
parent 276ea63b54
commit 01d0c01703
2 changed files with 62 additions and 2 deletions
+7 -2
View File
@@ -63,7 +63,10 @@ class FileWatcher extends AbstractProcess implements OnProcessInterface
public function __construct()
{
$this->watchPaths = config('servers.reload.listen', []);
$this->excludePatterns = config('servers.reload.scan.skip_patterns', []);
$this->excludePatterns = array_values(array_unique(array_merge(
['/vendor/', '/tests/', '/cache/', '/node_modules/', '/storage/', '/.git/', '/.idea/'],
config('servers.reload.scan.skip_patterns', [])
)));
$this->extensions = config('servers.reload.scan.extensions', ['php']);
di(EventProvider::class)->on(OnWorkerStart::class, [di(Router::class), 'scan_build_route']);
@@ -237,8 +240,10 @@ class FileWatcher extends AbstractProcess implements OnProcessInterface
private function isExcluded(string $path): bool
{
$path = '/' . trim(str_replace('\\', '/', $path), '/') . '/';
foreach ($this->excludePatterns as $pattern) {
if (strpos($path, $pattern) !== false) {
$pattern = '/' . trim(str_replace('\\', '/', (string)$pattern), '/') . '/';
if ($pattern !== '//' && strpos($path, $pattern) !== false) {
return true;
}
}