Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
feat: Release v3.0.0 - PHPStan-style analysis, configuration, baseline, and advanced WCAG rules
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace YakNet\AccessibilityConsole\Core;
|
||||
|
||||
use HeadlessChromium\BrowserFactory;
|
||||
use HeadlessChromium\Navigation;
|
||||
|
||||
class ChromeRenderer
|
||||
{
|
||||
/**
|
||||
* Navigate to URL using headless Chrome and return fully rendered HTML.
|
||||
*/
|
||||
public function render(string $url): string
|
||||
{
|
||||
$browserFactory = new BrowserFactory();
|
||||
|
||||
$options = [
|
||||
'windowSize' => [1280, 1024],
|
||||
'noSandbox' => true,
|
||||
];
|
||||
|
||||
// Windows Chrome binary path auto-detection override
|
||||
$chromeBinary = $_ENV['CHROME_BINARY'] ?? getenv('CHROME_BINARY') ?: null;
|
||||
if (!$chromeBinary && PHP_OS_FAMILY === 'Windows') {
|
||||
$standardPaths = [
|
||||
'C:/Program Files/Google/Chrome/Application/chrome.exe',
|
||||
'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe',
|
||||
'C:/Program Files/Google/Chrome/Application/chrome.exe'
|
||||
];
|
||||
foreach ($standardPaths as $path) {
|
||||
if (file_exists($path)) {
|
||||
$chromeBinary = $path;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($chromeBinary) {
|
||||
$options['chromeBinary'] = $chromeBinary;
|
||||
}
|
||||
|
||||
$browser = $browserFactory->createBrowser($options);
|
||||
|
||||
try {
|
||||
$page = $browser->createPage();
|
||||
|
||||
// Navigate and wait for onload event
|
||||
$navigation = $page->navigate($url);
|
||||
$navigation->waitForNavigation(\HeadlessChromium\Page::LOAD, 10000); // 10 seconds timeout
|
||||
|
||||
// Extra wait for async JS rendering to complete
|
||||
usleep(1500000); // 1.5s
|
||||
|
||||
$html = $page->getHtml();
|
||||
} finally {
|
||||
$browser->close();
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user