@@ -173,18 +173,20 @@ private function writeControllerFile(Collection $routes, string $namespace): voi
173
173
174
174
private function writeMultiRouteControllerMethodExport (Collection $ routes , string $ path ): void
175
175
{
176
+ $ isInvokable = $ routes ->first ()->hasInvokableController ();
177
+
176
178
$ this ->appendContent ($ path , $ this ->view ->make ('wayfinder::multi-method ' , [
177
179
'method ' => $ routes ->first ()->jsMethod (),
178
180
'original_method ' => $ routes ->first ()->originalJsMethod (),
179
181
'path ' => $ routes ->first ()->controllerPath (),
180
182
'line ' => $ routes ->first ()->controllerMethodLineNumber (),
181
183
'controller ' => $ routes ->first ()->controller (),
182
- 'isInvokable ' => $ isInvokable = $ routes -> first ()-> hasInvokableController () ,
184
+ 'isInvokable ' => $ isInvokable ,
183
185
'shouldExport ' => ! $ isInvokable ,
184
186
'withForm ' => $ this ->option ('with-form ' ) ?? false ,
185
187
'routes ' => $ routes ->map (fn ($ r ) => [
186
188
'method ' => $ r ->jsMethod (),
187
- 'tempMethod ' => $ r ->jsMethod ().hash ('xxh3 ' , $ r ->uri ()),
189
+ 'tempMethod ' => $ r ->jsMethod ().hash ('xxh128 ' , $ r ->uri ()),
188
190
'parameters ' => $ r ->parameters (),
189
191
'verbs ' => $ r ->verbs (),
190
192
'uri ' => $ r ->uri (),
@@ -198,8 +200,8 @@ private function writeControllerMethodExport(Route $route, string $path): void
198
200
'controller ' => $ route ->controller (),
199
201
'method ' => $ route ->jsMethod (),
200
202
'original_method ' => $ route ->originalJsMethod (),
201
- 'isInvokable ' => $ isInvokable = $ route ->hasInvokableController (),
202
- 'shouldExport ' => ! $ isInvokable ,
203
+ 'isInvokable ' => $ route ->hasInvokableController (),
204
+ 'shouldExport ' => ! $ route -> hasInvokableController () ,
203
205
'path ' => $ route ->controllerPath (),
204
206
'line ' => $ route ->controllerMethodLineNumber (),
205
207
'parameters ' => $ route ->parameters (),
@@ -247,11 +249,11 @@ private function appendCommonImports(Collection $routes, string $path, string $n
247
249
private function writeNamedMethodExport (Route $ route , string $ path ): void
248
250
{
249
251
$ this ->appendContent ($ path , $ this ->view ->make ('wayfinder::method ' , [
250
- 'controller ' => $ controller = $ route ->controller (),
252
+ 'controller ' => $ route ->controller (),
251
253
'method ' => $ route ->namedMethod (),
252
254
'original_method ' => $ route ->originalJsMethod (),
253
- 'isInvokable ' => $ isInvokable = $ route ->hasInvokableController (),
254
- 'shouldExport ' => ( ! $ isInvokable ) || str_contains ($ controller , '\\Closure ' ),
255
+ 'isInvokable ' => $ route ->hasInvokableController (),
256
+ 'shouldExport ' => ! $ route -> hasInvokableController ( ) || str_contains ($ route -> controller () , '\\Closure ' ),
255
257
'path ' => $ route ->controllerPath (),
256
258
'line ' => $ route ->controllerMethodLineNumber (),
257
259
'parameters ' => $ route ->parameters (),
@@ -274,7 +276,7 @@ private function writeBarrelFiles(array|Collection $children, string $parent): v
274
276
$ childKeys = $ children ->keys ()->mapWithKeys (fn ($ child ) => [
275
277
$ child => [
276
278
'safe ' => TypeScript::safeMethod ($ child , 'Method ' ),
277
- 'normalized ' => ( string ) str ($ child )->whenContains ('- ' , fn ($ s ) => $ s ->camel ()),
279
+ 'normalized ' => str ($ child )->whenContains ('- ' , fn ($ s ) => $ s ->camel ())-> toString ( ),
278
280
],
279
281
]);
280
282
0 commit comments