Skip to content

Commit

Permalink
Merge branch 'master' into 2.4.1-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVanderbist committed Mar 8, 2021
2 parents 11ffca1 + 17097f7 commit 1f1f688
Show file tree
Hide file tree
Showing 24 changed files with 446 additions and 103 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/run-tests.yml
Expand Up @@ -12,13 +12,15 @@ jobs:

strategy:
matrix:
php: [7.4, 7.3, 7.2]
laravel: [7.*]
dependency-version: [prefer-lowest, prefer-stable]
php: [7.4, 8.0]
laravel: [7.*, 8.*]
dependency-version: [prefer-stable]
os: [ubuntu-latest, windows-latest]
include:
- laravel: 7.*
testbench: 5.*
- laravel: 8.*
testbench: 6.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

Expand All @@ -32,11 +34,17 @@ jobs:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none
tools: composer:v2

- name: Install dependencies
- name: Install PHP 7 dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --no-interaction --no-progress
if: "matrix.php < 8"

- name: Install PHP 8 dependencies
run: composer update --${{ matrix.dependency-version }} --ignore-platform-req=php --no-interaction --no-progress
if: "matrix.php >= 8"

- name: Execute tests
run: vendor/bin/phpunit
Expand Down
63 changes: 62 additions & 1 deletion CHANGELOG.md
Expand Up @@ -2,6 +2,67 @@

All notable changes to `ignition` will be documented in this file

## 2.5.14 - 2021-03-03

- fix ignition not working when there is no argv

## 2.5.13 - 2021-02-16

- remove custom grouping

## 2.5.12 - 2021-02-15

- fix wrong config usage (#354)

## 2.5.11 - 2021-02-05

- fix memory leaks caused by log and query recorder (#344)

## 2.5.10 - 2021-02-02

- fix tinker logs not being sent to Flare

## 2.5.9 - 2021-01-26

- fix logged context not being sent to Flare

## 2.5.8 - 2020-12-29

- fix double `$` on PHP 8 (#338)

## 2.5.7 - 2020-12-29

- fix for breaking change in highlight.js (fixes 2.5.5)

## 2.5.6 - 2020-12-29

- revert to compiled js of 2.5.3

## 2.5.5 - 2020-12-29

- added compiled js of previous release

## 2.5.4 - 2020-12-29

- added support for Nova text editor (#343)

## 2.5.3 - 2020-12-08

- Use Livewire compatible compiler engine when using Livewire (#340)

## 2.5.2 - 2020-11-14

- fix `MakeViewVariableOptionalSolution` to disallow stream wrappers and files that do not end in ".blade.php" (#334)

## 2.5.1 - 2020-11-13

- add support for LiveWire component urls

## 2.5.0 - 2020-10-27

- add PHP 8.0-dev support
- remove unnecessary `scrivo/highlight.php` dependency

## 2.4.1 - 2020-10-14

- fix copy casing
Expand All @@ -17,7 +78,7 @@ All notable changes to `ignition` will be documented in this file
## 2.3.7 - 2020-09-06

- add loading state on share button (#309)
- compatiblity fix for L8
- compatibility fix for L8

## 2.3.6 - 2020-08-10

Expand Down
7 changes: 3 additions & 4 deletions composer.json
Expand Up @@ -10,15 +10,14 @@
"homepage": "https://github.com/facade/ignition",
"license": "MIT",
"require": {
"php": "^7.2.5",
"php": "^7.2.5|^8.0",
"ext-json": "*",
"ext-mbstring": "*",
"facade/flare-client-php": "^1.0",
"facade/ignition-contracts": "^1.0",
"facade/flare-client-php": "^1.3.7",
"facade/ignition-contracts": "^1.0.2",
"filp/whoops": "^2.4",
"illuminate/support": "^7.0|^8.0",
"monolog/monolog": "^2.0",
"scrivo/highlight.php": "^9.15",
"symfony/console": "^5.0",
"symfony/var-dumper": "^5.0"
},
Expand Down
2 changes: 2 additions & 0 deletions config/flare.php
Expand Up @@ -32,6 +32,8 @@
'report_query_bindings' => true,
'report_view_data' => true,
'grouping_type' => null,
'report_logs' => true,
'maximum_number_of_collected_logs' => 200,
],

/*
Expand Down
2 changes: 1 addition & 1 deletion config/ignition.php
Expand Up @@ -10,7 +10,7 @@
| Choose your preferred editor to use when clicking any edit button.
|
| Supported: "phpstorm", "vscode", "vscode-insiders",
| "sublime", "atom"
| "sublime", "atom", "nova"
|
*/

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -7,7 +7,7 @@
},
"dependencies": {
"git-url-parse": "^11.1.2",
"highlight.js": "^9.15.6",
"highlight.js": "^10.4.1",
"lodash": "^4.17.19",
"markdown-it": "^9.0.1",
"md5": "^2.2.1",
Expand Down
8 changes: 4 additions & 4 deletions resources/compiled/ignition.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/js/components/Shared/editorUrl.js
Expand Up @@ -10,6 +10,7 @@ export default function editorUrl(config, file, lineNumber) {
vscode: 'vscode://file/%path:%line',
'vscode-insiders': 'vscode-insiders://file/%path:%line',
atom: 'atom://core/open/file?filename=%path&line=%line',
nova: 'nova://core/open/file?filename=%path&line=%line',
};

file =
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/Solutions/SolutionCard.vue
Expand Up @@ -73,15 +73,15 @@
</button>
<p v-if="executionSuccessful">
<strong class="font-semibold"
>The solution was executed succesfully.</strong
>The solution was executed successfully.</strong
>
<a href="#" @click.prevent="refresh" class="link-solution"
>Refresh now.</a
>
</p>
<p v-if="executionSuccessful === false">
Something went wrong when executing the solution. Please try
refresh the page and try again.
refreshing the page and try again.
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/Stack/Snippet.vue
Expand Up @@ -50,7 +50,7 @@
</template>

<script>
import hljs from 'highlight.js/lib/highlight';
import hljs from 'highlight.js/lib/core';
hljs.registerLanguage('php', require('highlight.js/lib/languages/php'));
import ExceptionClass from '../Shared/ExceptionClass.vue';
Expand Down
12 changes: 12 additions & 0 deletions src/Context/LaravelRequestContext.php
Expand Up @@ -54,6 +54,18 @@ public function getRoute(): array
];
}

public function getRequest(): array
{
$properties = parent::getRequest();


if ($this->request->hasHeader('x-livewire') && $this->request->hasHeader('referer')) {
$properties['url'] = $this->request->header('referer');
}

return $properties;
}

protected function getRouteParameters(): array
{
try {
Expand Down
90 changes: 59 additions & 31 deletions src/IgnitionServiceProvider.php
Expand Up @@ -3,6 +3,7 @@
namespace Facade\Ignition;

use Exception;
use Facade\FlareClient\Api;
use Facade\FlareClient\Flare;
use Facade\FlareClient\Http\Client;
use Facade\Ignition\Commands\SolutionMakeCommand;
Expand All @@ -28,7 +29,6 @@
use Facade\Ignition\Middleware\AddLogs;
use Facade\Ignition\Middleware\AddQueries;
use Facade\Ignition\Middleware\AddSolutions;
use Facade\Ignition\Middleware\CustomizeGrouping;
use Facade\Ignition\Middleware\SetNotifierName;
use Facade\Ignition\QueryRecorder\QueryRecorder;
use Facade\Ignition\SolutionProviders\BadMethodCallSolutionProvider;
Expand Down Expand Up @@ -78,6 +78,10 @@ public function boot()
$this->publishes([
__DIR__.'/../config/ignition.php' => config_path('ignition.php'),
], 'ignition-config');

if (isset($_SERVER['argv']) && ['artisan', 'tinker'] === $_SERVER['argv']) {
Api::sendReportsInBatches(false);
}
}

$this
Expand All @@ -90,8 +94,14 @@ public function boot()
$this->setupQueue($this->app->get('queue'));
}

$this->app->make(QueryRecorder::class)->register();
$this->app->make(LogRecorder::class)->register();
if (config('flare.reporting.report_logs')) {
$this->app->make(LogRecorder::class)->register();
}

if (config('flare.reporting.report_queries')) {
$this->app->make(QueryRecorder::class)->register();
}

$this->app->make(DumpRecorder::class)->register();
}

Expand All @@ -106,9 +116,12 @@ public function register()
->registerWhoopsHandler()
->registerIgnitionConfig()
->registerFlare()
->registerLogRecorder()
->registerDumpCollector();

if (config('flare.reporting.report_logs')) {
$this->registerLogRecorder();
}

if (config('flare.reporting.report_queries')) {
$this->registerQueryRecorder();
}
Expand All @@ -131,6 +144,10 @@ protected function registerViewEngines()
});

$this->app->make('view.engine.resolver')->register('blade', function () {
if (class_exists(\Livewire\CompilerEngineForIgnition::class)) {
return new \Livewire\CompilerEngineForIgnition($this->app['blade.compiler']);
}

return new CompilerEngine($this->app['blade.compiler']);
});

Expand Down Expand Up @@ -275,13 +292,14 @@ protected function getLogLevel(string $logLevelString): int
return $logLevel;
}

protected function registerLogRecorder()
protected function registerLogRecorder(): self
{
$logCollector = $this->app->make(LogRecorder::class);

$this->app->singleton(LogRecorder::class);

$this->app->instance(LogRecorder::class, $logCollector);
$this->app->singleton(LogRecorder::class, function (Application $app): LogRecorder {
return new LogRecorder(
$app,
$app->get('config')->get('flare.reporting.maximum_number_of_collected_logs')
);
});

return $this;
}
Expand Down Expand Up @@ -315,37 +333,45 @@ protected function registerCommands()
return $this;
}

protected function registerQueryRecorder()
protected function registerQueryRecorder(): self
{
$queryCollector = $this->app->make(QueryRecorder::class);

$this->app->singleton(QueryRecorder::class);

$this->app->instance(QueryRecorder::class, $queryCollector);
$this->app->singleton(QueryRecorder::class, function (Application $app): QueryRecorder {
return new QueryRecorder(
$app,
$app->get('config')->get('flare.reporting.report_query_bindings'),
$app->get('config')->get('flare.reporting.maximum_number_of_collected_queries')
);
});

return $this;
}

protected function registerBuiltInMiddleware()
{
$middleware = collect([
$middlewares = [
SetNotifierName::class,
AddEnvironmentInformation::class,
AddLogs::class,
AddDumps::class,
AddQueries::class,
AddSolutions::class,
])
->map(function (string $middlewareClass) {
return $this->app->make($middlewareClass);
});
];

if (config('flare.reporting.collect_git_information')) {
$middleware[] = (new AddGitInformation());
if (config('flare.reporting.report_logs')) {
$middlewares[] = AddLogs::class;
}

if (! is_null(config('flare.reporting.grouping_type'))) {
$middleware[] = new CustomizeGrouping(config('flare.reporting.grouping_type'));
$middlewares[] = AddDumps::class;

if (config('flare.reporting.report_queries')) {
$middlewares[] = AddQueries::class;
}

$middlewares[] = AddSolutions::class;

$middleware = collect($middlewares)
->map(function (string $middlewareClass) {
return $this->app->make($middlewareClass);
});

if (config('flare.reporting.collect_git_information')) {
$middleware[] = (new AddGitInformation());
}

foreach ($middleware as $singleMiddleware) {
Expand Down Expand Up @@ -432,12 +458,14 @@ protected function setupQueue(QueueManager $queue)
$queue->looping(function () {
$this->app->get(Flare::class)->reset();

if (config('flare.reporting.report_logs')) {
$this->app->make(LogRecorder::class)->reset();
}

if (config('flare.reporting.report_queries')) {
$this->app->make(QueryRecorder::class)->reset();
}

$this->app->make(LogRecorder::class)->reset();

$this->app->make(DumpRecorder::class)->reset();
});
}
Expand Down

0 comments on commit 1f1f688

Please sign in to comment.