Skip to content

Conversation

istiak-tridip
Copy link
Contributor

@istiak-tridip istiak-tridip commented May 22, 2025

This PR fixes a few bugs & makes some refactors.

Bugs Fixed

  1. Handle route names that start with characters invalid for JavaScript identifiers
// Example
Route::get('/auth/2fa', TwoFactorAuthChallenge::class)->name('2fa.challenge');
  1. Handle invalid JS identifiers and reserved keywords in barrel file exports (fixes Use of reserved keywords if present in route name #71)
// Example
Route::get('/login', DefaultLogin::class)->name('default.login');
  1. Expanded the list of reserved JavaScript/TypeScript keywords to fix naming conflicts
// Example
Route::get('/protected/blog-post', TwoFactorAuthChallenge::class)->name('protected.post');
  1. Fixed JSDoc @see tags for invokable controller routes
// Example route
Route::get('/', HomePage::class)->name('home');
- * @see \App\Domains\Public\Pages\HomePage::home
+ * @see \App\Domains\Public\Pages\HomePage::__invoke

Refactors

  • Replaced the md5 hashing algorithm with the significantly faster xxh3
  • Refactored the conditions determining when generated route helpers are exported, as part of fixing the JSDoc issue for invokable routes.

P.S. Hey @joetannenbaum, a quick question regarding reserved route names like delete becoming deleteMethod. Given these are routes, I wondered if Route (e.g., deleteRoute) might be an alternative. Appreciate any insight!

@joetannenbaum
Copy link
Collaborator

Thanks! Good point on naming, I'll re-examine in the next Wayfinder beta coming up 👍

@joetannenbaum joetannenbaum merged commit 858ff87 into laravel:main Aug 19, 2025
6 checks passed
@istiak-tridip istiak-tridip deleted the fix/bugs branch August 20, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use of reserved keywords if present in route name
3 participants