changes
This commit is contained in:
12
vendor/spatie/laravel-ignition/composer.json
vendored
12
vendor/spatie/laravel-ignition/composer.json
vendored
@ -22,8 +22,8 @@
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"illuminate/support": "^10.0|^11.0",
|
||||
"spatie/flare-client-php": "^1.3.5",
|
||||
"spatie/ignition": "^1.13.2",
|
||||
"spatie/flare-client-php": "^1.5",
|
||||
"spatie/ignition": "^1.14",
|
||||
"symfony/console": "^6.2.3|^7.0",
|
||||
"symfony/var-dumper": "^6.2.3|^7.0"
|
||||
},
|
||||
@ -31,11 +31,11 @@
|
||||
"livewire/livewire": "^2.11|^3.3.5",
|
||||
"mockery/mockery": "^1.5.1",
|
||||
"openai-php/client": "^0.8.1",
|
||||
"orchestra/testbench": "^8.0|^9.0",
|
||||
"pestphp/pest": "^2.30",
|
||||
"phpstan/extension-installer": "^1.2",
|
||||
"orchestra/testbench": "8.22.3|^9.0",
|
||||
"pestphp/pest": "^2.34",
|
||||
"phpstan/extension-installer": "^1.3.1",
|
||||
"phpstan/phpstan-deprecation-rules": "^1.1.1",
|
||||
"phpstan/phpstan-phpunit": "^1.3.3",
|
||||
"phpstan/phpstan-phpunit": "^1.3.16",
|
||||
"vlucas/phpdotenv": "^5.5"
|
||||
},
|
||||
"suggest": {
|
||||
|
@ -6,6 +6,7 @@ use Spatie\FlareClient\FlareMiddleware\CensorRequestBodyFields;
|
||||
use Spatie\FlareClient\FlareMiddleware\CensorRequestHeaders;
|
||||
use Spatie\LaravelIgnition\FlareMiddleware\AddDumps;
|
||||
use Spatie\LaravelIgnition\FlareMiddleware\AddEnvironmentInformation;
|
||||
use Spatie\LaravelIgnition\FlareMiddleware\AddExceptionHandledStatus;
|
||||
use Spatie\LaravelIgnition\FlareMiddleware\AddExceptionInformation;
|
||||
use Spatie\LaravelIgnition\FlareMiddleware\AddJobs;
|
||||
use Spatie\LaravelIgnition\FlareMiddleware\AddLogs;
|
||||
@ -55,6 +56,7 @@ return [
|
||||
'max_chained_job_reporting_depth' => 5,
|
||||
],
|
||||
AddContext::class,
|
||||
AddExceptionHandledStatus::class,
|
||||
CensorRequestBodyFields::class => [
|
||||
'censor_fields' => [
|
||||
'password',
|
||||
@ -70,7 +72,7 @@ return [
|
||||
'X-CSRF-TOKEN',
|
||||
'X-XSRF-TOKEN',
|
||||
]
|
||||
]
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|
@ -6,6 +6,7 @@ use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
use Livewire\LivewireManager;
|
||||
use Livewire\Mechanisms\ComponentRegistry;
|
||||
|
||||
class LaravelLivewireRequestContextProvider extends LaravelRequestContextProvider
|
||||
{
|
||||
@ -37,9 +38,29 @@ class LaravelLivewireRequestContextProvider extends LaravelRequestContextProvide
|
||||
return $properties;
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
/** @return array<int, mixed> */
|
||||
protected function getLivewireInformation(): array
|
||||
{
|
||||
if ($this->request->has('components')) {
|
||||
$data = [];
|
||||
|
||||
foreach ($this->request->get('components') as $component) {
|
||||
$snapshot = json_decode($component['snapshot'], true);
|
||||
|
||||
$class = app(ComponentRegistry::class)->getClass($snapshot['memo']['name']);
|
||||
|
||||
$data[] = [
|
||||
'component_class' => $class ?? null,
|
||||
'data' => $snapshot['data'],
|
||||
'memo' => $snapshot['memo'],
|
||||
'updates' => $this->resolveUpdates($component['updates']),
|
||||
'calls' => $component['calls'],
|
||||
];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
$componentId = $this->request->input('fingerprint.id');
|
||||
|
||||
@ -56,12 +77,20 @@ class LaravelLivewireRequestContextProvider extends LaravelRequestContextProvide
|
||||
$componentClass = null;
|
||||
}
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
$updates = $this->request->input('updates') ?? [];
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
$updates = $this->request->input('updates') ?? [];
|
||||
|
||||
return [
|
||||
'component_class' => $componentClass,
|
||||
'component_alias' => $componentAlias,
|
||||
'component_id' => $componentId,
|
||||
'data' => $this->resolveData(),
|
||||
'updates' => $this->resolveUpdates(),
|
||||
[
|
||||
'component_class' => $componentClass,
|
||||
'component_alias' => $componentAlias,
|
||||
'component_id' => $componentId,
|
||||
'data' => $this->resolveData(),
|
||||
'updates' => $this->resolveUpdates($updates),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@ -86,7 +115,7 @@ class LaravelLivewireRequestContextProvider extends LaravelRequestContextProvide
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
protected function resolveUpdates(): array
|
||||
protected function resolveUpdates(array $updates): array
|
||||
{
|
||||
/** @phpstan-ignore-next-line */
|
||||
$updates = $this->request->input('updates') ?? [];
|
||||
|
@ -13,7 +13,7 @@ class AddContext implements FlareMiddleware
|
||||
public function handle(Report $report, Closure $next)
|
||||
{
|
||||
if (! class_exists(Repository::class)) {
|
||||
return $report;
|
||||
return $next($report);
|
||||
}
|
||||
|
||||
$allContext = Context::all();
|
||||
@ -22,6 +22,6 @@ class AddContext implements FlareMiddleware
|
||||
$report->group('laravel_context', $allContext);
|
||||
}
|
||||
|
||||
return $report;
|
||||
return $next($report);
|
||||
}
|
||||
}
|
||||
|
53
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddExceptionHandledStatus.php
vendored
Normal file
53
vendor/spatie/laravel-ignition/src/FlareMiddleware/AddExceptionHandledStatus.php
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Spatie\LaravelIgnition\FlareMiddleware;
|
||||
|
||||
use Closure;
|
||||
use Spatie\Backtrace\Backtrace;
|
||||
use Spatie\FlareClient\FlareMiddleware\FlareMiddleware;
|
||||
use Spatie\FlareClient\Report;
|
||||
use Throwable;
|
||||
|
||||
class AddExceptionHandledStatus implements FlareMiddleware
|
||||
{
|
||||
public function handle(Report $report, Closure $next)
|
||||
{
|
||||
$frames = Backtrace::create()->limit(40)->frames();
|
||||
$frameCount = count($frames);
|
||||
|
||||
try {
|
||||
foreach ($frames as $i => $frame) {
|
||||
// Check first frame, probably Illuminate\Foundation\Exceptions\Handler::report()
|
||||
// Next frame should be: Illuminate/Foundation/helpers.php::report()
|
||||
|
||||
if ($frame->method !== 'report') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($frame->class === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($i === $frameCount - 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($frames[$i + 1]->class !== null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($frames[$i + 1]->method !== 'report') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$report->handled();
|
||||
|
||||
break;
|
||||
}
|
||||
} catch (Throwable) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
return $next($report);
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace Spatie\LaravelIgnition\Views;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Contracts\View\Engine;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\Arr;
|
||||
@ -19,7 +18,9 @@ use Throwable;
|
||||
class ViewExceptionMapper
|
||||
{
|
||||
protected Engine $compilerEngine;
|
||||
|
||||
protected BladeSourceMapCompiler $bladeSourceMapCompiler;
|
||||
|
||||
protected array $knownPaths;
|
||||
|
||||
public function __construct(BladeSourceMapCompiler $bladeSourceMapCompiler)
|
||||
@ -80,15 +81,27 @@ class ViewExceptionMapper
|
||||
|
||||
protected function modifyViewsInTrace(IgnitionViewException $exception): void
|
||||
{
|
||||
$viewIndex = null;
|
||||
|
||||
$trace = Collection::make($exception->getPrevious()->getTrace())
|
||||
->map(function ($trace) {
|
||||
->map(function ($trace, $index) use (&$viewIndex) {
|
||||
if ($originalPath = $this->findCompiledView(Arr::get($trace, 'file', ''))) {
|
||||
|
||||
$trace['file'] = $originalPath;
|
||||
$trace['line'] = $this->getBladeLineNumber($trace['file'], $trace['line']);
|
||||
|
||||
if ($viewIndex === null) {
|
||||
$viewIndex = $index;
|
||||
}
|
||||
}
|
||||
|
||||
return $trace;
|
||||
})->toArray();
|
||||
})
|
||||
->when(
|
||||
$viewIndex !== null && str_ends_with($exception->getFile(), '.blade.php'),
|
||||
fn (Collection $trace) => $trace->slice($viewIndex + 1) // Remove all traces before the view
|
||||
)
|
||||
->toArray();
|
||||
|
||||
$traceProperty = new ReflectionProperty('Exception', 'trace');
|
||||
$traceProperty->setAccessible(true);
|
||||
|
Reference in New Issue
Block a user