This commit is contained in:
2026-07-10 15:57:45 +08:00
parent 614f21b240
commit e7d5d1b567
+7 -5
View File
@@ -255,12 +255,14 @@ class Router
}
}
if (!empty($appChangedFiles)) {
if (!empty($appChangedFiles) && (bool)($scanConfig['expand_dependencies'] ?? false)) {
$appChangedFiles = $scanner->expandDependentFiles($appChangedFiles, APP_PATH . 'app/');
}
$usedArtifact = false;
if (($scanConfig['cache_enabled'] ?? false) && $artifactState->has(static::$type)) {
$canUseArtifact = $artifactState->has(static::$type)
&& (!empty($changedFiles) || ($scanConfig['cache_enabled'] ?? false));
if ($canUseArtifact) {
$artifact = $artifactState->load(static::$type);
$router = $container->get(DataGrip::class)->get(static::$type);
$usedArtifact = $router->importArtifact($artifact, $appChangedFiles);
@@ -270,12 +272,12 @@ class Router
// route artifact 只加速注解路由,不能替代 routes/*.php 的注册副作用。
$this->read_dir_file(APP_PATH . 'routes');
if (!empty($appChangedFiles) && ($scanConfig['cache_enabled'] ?? false)) {
$scanner->scanFiles($appChangedFiles, APP_PATH . 'app/', null, true);
if (!empty($appChangedFiles) && (($scanConfig['cache_enabled'] ?? false) || $usedArtifact)) {
$scanner->scanFiles($appChangedFiles, APP_PATH . 'app/', null, true, !$usedArtifact);
} elseif (!$usedArtifact) {
$scanner->scan(APP_PATH . 'app/');
} else {
$scanner->scanFiles([], APP_PATH . 'app/', null, false);
$scanner->scanFiles([], APP_PATH . 'app/', null, false, false);
}
$this->reset($container);
$artifactState->store(static::$type, $container->get(DataGrip::class)->get(static::$type)->exportArtifact());