Skip to content

Commit 89ec8f9

Browse files
committed
return from php the directories to watch
1 parent 0b2acfe commit 89ec8f9

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

php-templates/routes.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,4 @@ protected function getRouteReflection(\Illuminate\Routing\Route $route)
9393
}
9494
};
9595

96-
9796
echo $routes->all()->toJson();

php-templates/translations.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
public $emptyParams = [];
1414

15+
public $directoriesToWatch = [];
16+
1517
public function all()
1618
{
1719
$final = [];
@@ -82,6 +84,10 @@ public function collectFromPath(string $path, ?string $namespace = null)
8284
return [];
8385
}
8486

87+
if (!LaravelVsCode::isVendor($realPath)) {
88+
$this->directoriesToWatch[] = LaravelVsCode::relativePath($realPath);
89+
}
90+
8591
return array_map(
8692
fn($file) => $this->fromFile($file, $path, $namespace),
8793
\Illuminate\Support\Facades\File::allFiles($realPath),
@@ -342,4 +348,5 @@ protected function fromPhpFile($file, $path, $namespace)
342348
'paths' => array_keys($translator->paths),
343349
'values' => array_keys($translator->values),
344350
'params' => array_map(fn($p) => json_decode($p, true), array_keys($translator->paramResults)),
351+
'to_watch' => $translator->directoriesToWatch,
345352
]);

src/templates/routes.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,5 @@ $routes = new class {
9393
}
9494
};
9595
96-
9796
echo $routes->all()->toJson();
9897
`;

src/templates/translations.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ $translator = new class
1212
1313
public $emptyParams = [];
1414
15+
public $directoriesToWatch = [];
16+
1517
public function all()
1618
{
1719
$final = [];
@@ -82,6 +84,10 @@ $translator = new class
8284
return [];
8385
}
8486
87+
if (!LaravelVsCode::isVendor($realPath)) {
88+
$this->directoriesToWatch[] = LaravelVsCode::relativePath($realPath);
89+
}
90+
8591
return array_map(
8692
fn($file) => $this->fromFile($file, $path, $namespace),
8793
\\Illuminate\\Support\\Facades\\File::allFiles($realPath),
@@ -342,5 +348,6 @@ echo json_encode([
342348
'paths' => array_keys($translator->paths),
343349
'values' => array_keys($translator->values),
344350
'params' => array_map(fn($p) => json_decode($p, true), array_keys($translator->paramResults)),
351+
'to_watch' => $translator->directoriesToWatch,
345352
]);
346353
`;

0 commit comments

Comments
 (0)