Skip to content

Commit 37d60de

Browse files
committed
Change pure directive to blaze
1 parent 61415c0 commit 37d60de

39 files changed

+221
-214
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ A clear and concise description of what the bug is.
1616
```
1717

1818
**Expected behavior**
19-
What you expected to happen when using `@pure`.
19+
What you expected to happen when using `@blaze`.
2020

2121
**Actual behavior**
2222
What actually happened instead.
@@ -27,4 +27,4 @@ What actually happened instead.
2727
- Blaze version: [e.g. 1.0.0]
2828

2929
**Additional context**
30-
Add any other context about the problem here (error messages, stack traces, etc.)
30+
Add any other context about the problem here (error messages, stack traces, etc.)

AGENTS.md

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@ This document provides guidance for AI assistants helping users work with Larave
66

77
Laravel Blaze is a performance optimization package that pre-renders static portions of Blade components at compile-time, dramatically reducing runtime overhead. It works by:
88

9-
1. Identifying components marked with the `@pure` directive in their source
9+
1. Identifying components marked with the `@blaze` directive in their source
1010
2. Analyzing component source for runtime dependencies
1111
3. Pre-rendering eligible components during Blade compilation
1212
4. Falling back to normal rendering for unsafe components
1313

1414
## Core Concepts
1515

16-
### The @pure Directive
16+
### The @blaze Directive
1717

18-
The `@pure` directive tells Blaze that a component has no runtime dependencies and can be safely optimized. It must be placed at the top of a component file:
18+
The `@blaze` directive tells Blaze that a component has no runtime dependencies and can be safely optimized. It must be placed at the top of a component file:
1919

2020
```blade
21-
@pure
21+
@blaze
2222
2323
@props(['title'])
2424
2525
<h1 class="text-2xl font-bold">{{ $title }}</h1>
2626
```
2727

28-
The `@pure` directive supports optional parameters to control different optimization strategies:
28+
The `@blaze` directive supports optional parameters to control different optimization strategies:
2929

3030
```blade
3131
{{-- All optimizations enabled (default) --}}
32-
@pure
32+
@blaze
3333
3434
{{-- Explicitly enable all optimizations --}}
35-
@pure(fold: true, memo: true, aware: true)
35+
@blaze(fold: true, memo: true, aware: true)
3636
3737
{{-- Disable specific optimizations --}}
38-
@pure(fold: false, memo: true, aware: false)
38+
@blaze(fold: false, memo: true, aware: false)
3939
```
4040

4141
**Parameters:**
@@ -45,7 +45,7 @@ The `@pure` directive supports optional parameters to control different optimiza
4545

4646
### Code Folding Process
4747

48-
When a `@pure` component is encountered, Blaze:
48+
When a `@blaze` component is encountered, Blaze:
4949
1. Replaces dynamic content being passed in via attributes or slots with placeholders
5050
2. Renders the component with placeholders
5151
3. Validates that placeholders are preserved
@@ -58,7 +58,7 @@ When a component can't be folded (due to dynamic content), Blaze automatically f
5858

5959
## Helping Users Analyze Components
6060

61-
When a user asks about adding `@pure` to a component or wants you to analyze their components, follow this process:
61+
When a user asks about adding `@blaze` to a component or wants you to analyze their components, follow this process:
6262

6363
### 1. Read and Analyze the Component
6464

@@ -67,37 +67,37 @@ First, examine the component source code for:
6767
- Dynamic content that changes per request
6868
- Dependencies on global state or context
6969

70-
### 2. Safe Patterns for @pure
70+
### 2. Safe Patterns for @blaze
7171

72-
Components are safe for `@pure` when they only:
72+
Components are safe for `@blaze` when they only:
7373
- Accept props and render them consistently
7474
- Perform simple data formatting (dates, strings, etc.)
7575
- Render slots without modification
7676

7777
Examples:
7878
```blade
7979
{{-- UI components --}}
80-
@pure
80+
@blaze
8181
<div class="card p-4 bg-white rounded shadow">{{ $slot }}</div>
8282
8383
{{-- Prop-based styling --}}
84-
@pure
84+
@blaze
8585
@props(['variant' => 'primary'])
8686
<button class="btn btn-{{ $variant }}">{{ $slot }}</button>
8787
8888
{{-- Simple formatting --}}
89-
@pure
89+
@blaze
9090
@props(['price'])
9191
<span class="font-mono">${{ number_format($price, 2) }}</span>
9292
9393
{{-- Components using @aware --}}
94-
@pure
94+
@blaze
9595
@aware(['theme'])
9696
@props(['theme' => 'light'])
9797
<div class="theme-{{ $theme }}">{{ $slot }}</div>
9898
```
9999

100-
### 3. Unsafe Patterns (Never @pure)
100+
### 3. Unsafe Patterns (Never @blaze)
101101

102102
**Authentication & Authorization:**
103103
- `@auth`, `@guest`, `@can`, `@cannot`
@@ -134,89 +134,89 @@ Examples:
134134
- Components that display pagination controls
135135
- Data tables with pagination
136136

137-
**Nested Non-Pure Components:**
137+
**Nested Non-Foldable Components:**
138138
- Components that contain other components which use runtime data
139-
- Parent components can't be `@pure` if any child component is dynamic
140-
- Watch for `<x-*>` tags inside the component that might be non-pure
139+
- Parent components can't be `@blaze` if any child component is dynamic
140+
- Watch for `<x-*>` tags inside the component that might be non-foldable
141141

142142
### 4. Analysis Process
143143

144144
When analyzing a component:
145145

146146
1. **Scan for unsafe patterns** using the lists above
147-
2. **Check for child components** - look for any `<x-*>` tags and verify they are also pure
147+
2. **Check for child components** - look for any `<x-*>` tags and verify they are also foldable
148148
3. **Check for indirect dependencies** - props that might contain dynamic data (like paginator objects)
149149
4. **Consider context** - how the component is typically used
150150
5. **Test edge cases** - what happens with different prop values
151151

152152
#### Special Case: Nested Components
153153

154-
When a component directly renders other Blade components in its template (not via slots), verify those are also pure:
154+
When a component directly renders other Blade components in its template (not via slots), verify those are also foldable:
155155

156156
```blade
157157
{{-- Parent component --}}
158-
@pure <!-- ⚠️ Only safe if directly rendered child components are pure -->
158+
@blaze <!-- ⚠️ Only safe if directly rendered child components are foldable -->
159159
160160
<div class="data-table">
161-
<x-table-header /> <!-- Must be pure -->
161+
<x-table-header /> <!-- Must be foldable -->
162162
{{ $slot }} <!-- ✅ Slot content is handled separately, can be dynamic -->
163-
<x-table-footer /> <!-- Must be pure -->
164-
<x-table-pagination /> <!-- ❌ If this uses paginator, parent can't be @pure -->
163+
<x-table-footer /> <!-- Must be foldable -->
164+
<x-table-pagination /> <!-- ❌ If this uses paginator, parent can't be @blaze -->
165165
</div>
166166
```
167167

168168
**Key distinction**:
169-
- Components **hardcoded in the template** must be pure for the parent to be @pure
169+
- Components **hardcoded in the template** must be foldable for the parent to be @blaze
170170
- Content **passed through slots** is handled separately and can be dynamic
171171

172172
### 5. Making Recommendations
173173

174174
**For safe components:**
175175
```
176-
This component is safe for @pure because it only renders static HTML and passed props. Add @pure at the top of the file.
176+
This component is safe for @blaze because it only renders static HTML and passed props. Add @blaze at the top of the file.
177177
```
178178

179179
**For unsafe components:**
180180
```
181-
This component cannot use @pure because it contains [specific pattern]. The [pattern] changes at runtime and would be frozen at compile-time, causing incorrect behavior.
181+
This component cannot use @blaze because it contains [specific pattern]. The [pattern] changes at runtime and would be frozen at compile-time, causing incorrect behavior.
182182
```
183183

184184
**For borderline cases:**
185185
```
186-
This component might be safe for @pure, but consider if [specific concern]. Test thoroughly after adding @pure to ensure it behaves correctly across different requests. If folding isn't possible, memoization will still provide performance benefits.
186+
This component might be safe for @blaze, but consider if [specific concern]. Test thoroughly after adding @blaze to ensure it behaves correctly across different requests. If folding isn't possible, memoization will still provide performance benefits.
187187
```
188188

189189
## Common User Requests
190190

191-
### "Can I add @pure to this component?"
191+
### "Can I add @blaze to this component?"
192192

193193
1. Read the component file
194194
2. Analyze for unsafe patterns
195195
3. Provide a clear yes/no with explanation
196196
4. If no, suggest alternatives or modifications
197197

198-
### "Add @pure to my components"
198+
### "Add @blaze to my components"
199199

200200
1. Find all component files (`resources/views/components/**/*.blade.php`)
201201
2. Analyze each component individually
202-
3. Add `@pure` only to safe components (include a line break after `@pure` )
202+
3. Add `@blaze` only to safe components (include a line break after `@blaze` )
203203
4. Report which components were modified and which were skipped with reasons
204204

205205
### "Optimize my Blade components"
206206

207-
1. Audit existing components for @pure eligibility
208-
2. Identify components that could be refactored to be pure
207+
1. Audit existing components for @blaze eligibility
208+
2. Identify components that could be refactored to be foldable
209209
3. Suggest architectural improvements for better optimization
210210
4. Provide before/after examples
211211

212212
## Implementation Guidelines
213213

214-
### Adding @pure to Components
214+
### Adding @blaze to Components
215215

216-
When adding `@pure` to a component:
216+
When adding `@blaze` to a component:
217217

218218
1. **Always read the component first** to understand its structure
219-
2. **Add @pure as the very first line** of the component file
219+
2. **Add @blaze as the very first line** of the component file
220220
3. **Preserve existing formatting** and structure
221221
4. **Don't modify component logic** unless specifically requested
222222

@@ -228,7 +228,7 @@ Example edit:
228228
<h1>{{ $title }}</h1>
229229
230230
{{-- After --}}
231-
@pure
231+
@blaze
232232
233233
@props(['title'])
234234
@@ -241,21 +241,21 @@ When processing multiple components:
241241

242242
1. **Process files individually** - don't batch edits
243243
2. **Report results clearly** - which succeeded, which failed, and why
244-
3. **Provide summary statistics** - "Added @pure to 15 of 23 components"
244+
3. **Provide summary statistics** - "Added @blaze to 15 of 23 components"
245245
4. **List problematic components** with specific reasons for skipping
246246

247247
### Error Handling
248248

249-
If Blaze detects unsafe patterns in a `@pure` component, it will show compilation errors. When helping users:
249+
If Blaze detects unsafe patterns in a `@blaze` component, it will show compilation errors. When helping users:
250250

251251
1. **Explain the error** in simple terms
252252
2. **Show the problematic code** and why it's unsafe
253-
3. **Suggest solutions** - remove @pure or refactor the component
253+
3. **Suggest solutions** - remove @blaze or refactor the component
254254
4. **Provide alternatives** if the optimization is important
255255

256256
## Testing Recommendations
257257

258-
After adding `@pure` to components:
258+
After adding `@blaze` to components:
259259

260260
1. **Test with different props** to ensure consistent rendering
261261
2. **Verify in different contexts** - authenticated vs guest users

0 commit comments

Comments
 (0)