Skip to content

Commit 8f04fc3

Browse files
authored
Handle @Volt directives in GuidelineComposer (#333)
* Handle @Volt directives in GuidelineComposer Signed-off-by: Pushpak Chhajed <[email protected]> * remove redundant @Volt directives checks Signed-off-by: Pushpak Chhajed <[email protected]> * Fix test Signed-off-by: Pushpak Chhajed <[email protected]> --------- Signed-off-by: Pushpak Chhajed <[email protected]>
1 parent 2278b9b commit 8f04fc3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Install/GuidelineComposer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ protected function renderContent(string $content, string $path): string
256256
$placeholders = [
257257
'`' => '___SINGLE_BACKTICK___',
258258
'<?php' => '___OPEN_PHP_TAG___',
259+
'@volt' => '___VOLT_DIRECTIVE___',
260+
'@endvolt' => '___ENDVOLT_DIRECTIVE___',
259261
];
260262

261263
$content = str_replace(array_keys($placeholders), array_values($placeholders), $content);

tests/Feature/Install/GuidelineComposerTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@
388388
test('renderContent handles blade and markdown files correctly', function (): void {
389389
$packages = new PackageCollection([
390390
new Package(Packages::LARAVEL, 'laravel/framework', '11.0.0'),
391+
new Package(Packages::VOLT, 'laravel/volt', '1.0.0'),
391392
]);
392393

393394
$this->roster->shouldReceive('packages')->andReturn($packages);
@@ -424,5 +425,10 @@
424425
// Processes blade variables correctly
425426
->toContain('=== .ai/test-blade-with-assist rules ===')
426427
->toContain('Run `npm install` to install dependencies')
427-
->toContain('Package manager: npm');
428+
->toContain('Package manager: npm')
429+
// Preserves @volt directives in blade templates
430+
->toContain('`@volt`')
431+
->toContain('@endvolt')
432+
->not->toContain('volt-anonymous-fragment')
433+
->not->toContain('@livewire');
428434
});

0 commit comments

Comments
 (0)