From c2bfcabb914952d87439f175e9a381e5c515befc Mon Sep 17 00:00:00 2001 From: cclilshy Date: Sat, 8 Feb 2025 14:59:24 +0800 Subject: [PATCH] Update: Decoupling octane and built --- src/{ => Built}/Command.php | 5 +++-- src/{ => Built}/Coroutine/ContainerMap.php | 2 +- src/{ => Built}/Coroutine/ContextManager.php | 2 +- src/{ => Built}/Events/RequestHandled.php | 2 +- src/{ => Built}/Events/RequestReceived.php | 10 +++++----- src/{ => Built}/Events/RequestTerminated.php | 4 ++-- src/{ => Built}/Events/WorkerErrorOccurred.php | 4 ++-- src/{ => Built}/Factory.php | 2 +- .../Listeners/FlushAuthenticationState.php | 2 +- src/{ => Built}/Listeners/FlushQueuedCookies.php | 2 +- src/{ => Built}/Listeners/FlushSessionState.php | 2 +- src/{ => Built}/Response/IteratorResponse.php | 2 +- src/{ => Built}/Traits/DispatchesEvents.php | 2 +- src/Config/ripple.php | 2 +- src/HttpWorker.php | 13 +++++++------ src/{ => Inspector}/Client.php | 8 ++++---- src/{ => Inspector}/Inspector.php | 2 +- src/Octane/Bin/ripple-server.bin.php | 2 +- src/Octane/Bin/ripple-ware.bin.php | 2 +- src/Octane/Commands/RippleStopCommand.php | 2 +- src/Octane/RippleClient.php | 2 +- src/Octane/RippleServerProcessInspector.php | 4 ++-- src/Provider.php | 1 + src/Virtual/server.bin.php | 4 ++-- 24 files changed, 43 insertions(+), 40 deletions(-) rename src/{ => Built}/Command.php (95%) rename src/{ => Built}/Coroutine/ContainerMap.php (97%) rename src/{ => Built}/Coroutine/ContextManager.php (97%) rename src/{ => Built}/Events/RequestHandled.php (96%) rename src/{ => Built}/Events/RequestReceived.php (83%) rename src/{ => Built}/Events/RequestTerminated.php (91%) rename src/{ => Built}/Events/WorkerErrorOccurred.php (89%) rename src/{ => Built}/Factory.php (98%) rename src/{ => Built}/Listeners/FlushAuthenticationState.php (95%) rename src/{ => Built}/Listeners/FlushQueuedCookies.php (94%) rename src/{ => Built}/Listeners/FlushSessionState.php (94%) rename src/{ => Built}/Response/IteratorResponse.php (96%) rename src/{ => Built}/Traits/DispatchesEvents.php (95%) rename src/{ => Inspector}/Client.php (95%) rename src/{ => Inspector}/Inspector.php (97%) diff --git a/src/Command.php b/src/Built/Command.php similarity index 95% rename from src/Command.php rename to src/Built/Command.php index c6922c6..c6a4d94 100755 --- a/src/Command.php +++ b/src/Built/Command.php @@ -10,8 +10,9 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple; +namespace Laravel\Ripple\Built; +use Laravel\Ripple\Inspector\Client; use Ripple\Utils\Output; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -52,7 +53,7 @@ public function initialize(InputInterface $input, OutputInterface $output): void /** * 运行服务 * - * @param \Laravel\Ripple\Client $client + * @param \Laravel\Ripple\Inspector\Client $client * * @return void */ diff --git a/src/Coroutine/ContainerMap.php b/src/Built/Coroutine/ContainerMap.php similarity index 97% rename from src/Coroutine/ContainerMap.php rename to src/Built/Coroutine/ContainerMap.php index 35ea87e..f724403 100755 --- a/src/Coroutine/ContainerMap.php +++ b/src/Built/Coroutine/ContainerMap.php @@ -10,7 +10,7 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple\Coroutine; +namespace Laravel\Ripple\Built\Coroutine; use Fiber; use Illuminate\Container\Container; diff --git a/src/Coroutine/ContextManager.php b/src/Built/Coroutine/ContextManager.php similarity index 97% rename from src/Coroutine/ContextManager.php rename to src/Built/Coroutine/ContextManager.php index a1afa8e..48d23d7 100755 --- a/src/Coroutine/ContextManager.php +++ b/src/Built/Coroutine/ContextManager.php @@ -10,7 +10,7 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple\Coroutine; +namespace Laravel\Ripple\Built\Coroutine; use Fiber; use Illuminate\Container\Container; diff --git a/src/Events/RequestHandled.php b/src/Built/Events/RequestHandled.php similarity index 96% rename from src/Events/RequestHandled.php rename to src/Built/Events/RequestHandled.php index f3d0e04..69769d3 100755 --- a/src/Events/RequestHandled.php +++ b/src/Built/Events/RequestHandled.php @@ -10,7 +10,7 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple\Events; +namespace Laravel\Ripple\Built\Events; use Illuminate\Foundation\Application; use Illuminate\Http\Request; diff --git a/src/Events/RequestReceived.php b/src/Built/Events/RequestReceived.php similarity index 83% rename from src/Events/RequestReceived.php rename to src/Built/Events/RequestReceived.php index d4cebb3..f808659 100755 --- a/src/Events/RequestReceived.php +++ b/src/Built/Events/RequestReceived.php @@ -10,15 +10,15 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple\Events; +namespace Laravel\Ripple\Built\Events; use Illuminate\Contracts\Container\BindingResolutionException; use Illuminate\Foundation\Application; use Illuminate\Http\Request; -use Laravel\Ripple\Coroutine\ContextManager; -use Laravel\Ripple\Listeners\FlushAuthenticationState; -use Laravel\Ripple\Listeners\FlushQueuedCookies; -use Laravel\Ripple\Listeners\FlushSessionState; +use Laravel\Ripple\Built\Coroutine\ContextManager; +use Laravel\Ripple\Built\Listeners\FlushAuthenticationState; +use Laravel\Ripple\Built\Listeners\FlushQueuedCookies; +use Laravel\Ripple\Built\Listeners\FlushSessionState; use Ripple\Utils\Output; class RequestReceived diff --git a/src/Events/RequestTerminated.php b/src/Built/Events/RequestTerminated.php similarity index 91% rename from src/Events/RequestTerminated.php rename to src/Built/Events/RequestTerminated.php index 605f0b4..bd2d398 100755 --- a/src/Events/RequestTerminated.php +++ b/src/Built/Events/RequestTerminated.php @@ -10,11 +10,11 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple\Events; +namespace Laravel\Ripple\Built\Events; use Illuminate\Foundation\Application; use Illuminate\Http\Request; -use Laravel\Ripple\Coroutine\ContextManager; +use Laravel\Ripple\Built\Coroutine\ContextManager; use Symfony\Component\HttpFoundation\Response; /** diff --git a/src/Events/WorkerErrorOccurred.php b/src/Built/Events/WorkerErrorOccurred.php similarity index 89% rename from src/Events/WorkerErrorOccurred.php rename to src/Built/Events/WorkerErrorOccurred.php index 1b32360..375dd56 100755 --- a/src/Events/WorkerErrorOccurred.php +++ b/src/Built/Events/WorkerErrorOccurred.php @@ -10,10 +10,10 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple\Events; +namespace Laravel\Ripple\Built\Events; use Illuminate\Foundation\Application; -use Laravel\Ripple\Coroutine\ContextManager; +use Laravel\Ripple\Built\Coroutine\ContextManager; use Throwable; class WorkerErrorOccurred diff --git a/src/Factory.php b/src/Built/Factory.php similarity index 98% rename from src/Factory.php rename to src/Built/Factory.php index f7ada2f..632fd2a 100755 --- a/src/Factory.php +++ b/src/Built/Factory.php @@ -10,7 +10,7 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple; +namespace Laravel\Ripple\Built; use Illuminate\Foundation\Application; use Ripple\File\File; diff --git a/src/Listeners/FlushAuthenticationState.php b/src/Built/Listeners/FlushAuthenticationState.php similarity index 95% rename from src/Listeners/FlushAuthenticationState.php rename to src/Built/Listeners/FlushAuthenticationState.php index 7d6cca4..a58b37d 100755 --- a/src/Listeners/FlushAuthenticationState.php +++ b/src/Built/Listeners/FlushAuthenticationState.php @@ -10,7 +10,7 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple\Listeners; +namespace Laravel\Ripple\Built\Listeners; use function with; diff --git a/src/Listeners/FlushQueuedCookies.php b/src/Built/Listeners/FlushQueuedCookies.php similarity index 94% rename from src/Listeners/FlushQueuedCookies.php rename to src/Built/Listeners/FlushQueuedCookies.php index 7720282..cedb40d 100755 --- a/src/Listeners/FlushQueuedCookies.php +++ b/src/Built/Listeners/FlushQueuedCookies.php @@ -10,7 +10,7 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple\Listeners; +namespace Laravel\Ripple\Built\Listeners; class FlushQueuedCookies { diff --git a/src/Listeners/FlushSessionState.php b/src/Built/Listeners/FlushSessionState.php similarity index 94% rename from src/Listeners/FlushSessionState.php rename to src/Built/Listeners/FlushSessionState.php index 7722a92..b11429c 100755 --- a/src/Listeners/FlushSessionState.php +++ b/src/Built/Listeners/FlushSessionState.php @@ -10,7 +10,7 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple\Listeners; +namespace Laravel\Ripple\Built\Listeners; class FlushSessionState { diff --git a/src/Response/IteratorResponse.php b/src/Built/Response/IteratorResponse.php similarity index 96% rename from src/Response/IteratorResponse.php rename to src/Built/Response/IteratorResponse.php index 4fe3491..ceddf92 100755 --- a/src/Response/IteratorResponse.php +++ b/src/Built/Response/IteratorResponse.php @@ -10,7 +10,7 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple\Response; +namespace Laravel\Ripple\Built\Response; use Closure; use Iterator; diff --git a/src/Traits/DispatchesEvents.php b/src/Built/Traits/DispatchesEvents.php similarity index 95% rename from src/Traits/DispatchesEvents.php rename to src/Built/Traits/DispatchesEvents.php index cbe21e7..b572148 100755 --- a/src/Traits/DispatchesEvents.php +++ b/src/Built/Traits/DispatchesEvents.php @@ -10,7 +10,7 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple\Traits; +namespace Laravel\Ripple\Built\Traits; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Foundation\Application; diff --git a/src/Config/ripple.php b/src/Config/ripple.php index 9da8df7..5fd0990 100755 --- a/src/Config/ripple.php +++ b/src/Config/ripple.php @@ -14,7 +14,7 @@ use Illuminate\Support\Env; return [ - 'HTTP_LISTEN' => Env::get('RIP_HTTP_LISTEN', 'http://127.0.0.1:8008'), + 'HTTP_LISTEN' => Env::get('RIP_HTTP_LISTEN', 'http://127.0.0.1:8000'), 'HTTP_WORKERS' => Env::get('RIP_HTTP_WORKERS', 1), 'WATCH' => Env::get('RIP_WATCH', 1) ]; diff --git a/src/HttpWorker.php b/src/HttpWorker.php index 7b7ce23..0ca6cbb 100755 --- a/src/HttpWorker.php +++ b/src/HttpWorker.php @@ -16,12 +16,13 @@ use Illuminate\Contracts\Container\BindingResolutionException; use Illuminate\Contracts\Http\Kernel; use Illuminate\Foundation\Application; -use Laravel\Ripple\Events\RequestHandled; -use Laravel\Ripple\Events\RequestReceived; -use Laravel\Ripple\Events\RequestTerminated; -use Laravel\Ripple\Events\WorkerErrorOccurred; -use Laravel\Ripple\Response\IteratorResponse; -use Laravel\Ripple\Traits\DispatchesEvents; +use Laravel\Ripple\Built\Events\RequestHandled; +use Laravel\Ripple\Built\Events\RequestReceived; +use Laravel\Ripple\Built\Events\RequestTerminated; +use Laravel\Ripple\Built\Events\WorkerErrorOccurred; +use Laravel\Ripple\Built\Factory; +use Laravel\Ripple\Built\Response\IteratorResponse; +use Laravel\Ripple\Built\Traits\DispatchesEvents; use Ripple\Http\Server; use Ripple\Http\Server\Request; use Ripple\Stream\Exception\ConnectionException; diff --git a/src/Client.php b/src/Inspector/Client.php similarity index 95% rename from src/Client.php rename to src/Inspector/Client.php index a424436..e0d37a7 100755 --- a/src/Client.php +++ b/src/Inspector/Client.php @@ -10,7 +10,7 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple; +namespace Laravel\Ripple\Inspector; use Illuminate\Support\Facades\Config; use Laravel\Ripple\Virtual\Virtual; @@ -38,7 +38,7 @@ class Client { - /*** @var \Laravel\Ripple\Inspector */ + /*** @var \Laravel\Ripple\Inspector\Inspector */ public readonly Inspector $inspector; /*** @var \Ripple\Channel\Channel */ @@ -95,7 +95,7 @@ public function start(bool $daemon = false): void $this->owner = true; $this->lock->exclusion(false); - $this->virtual = new Virtual(__DIR__ . '/Virtual/server.bin.php'); + $this->virtual = new Virtual(__DIR__ . '/../Virtual/server.bin.php'); $this->virtual->launch([ 'RIP_PROJECT_PATH' => base_path(), 'RIP_VIRTUAL_ID' => $this->virtual->id, @@ -122,7 +122,7 @@ public function start(bool $daemon = false): void Output::write("\033c"); $oldVirtual = $this->virtual; - $virtual = new Virtual(__DIR__ . '/Virtual/server.bin.php'); + $virtual = new Virtual(__DIR__ . '/../Virtual/server.bin.php'); $virtual->launch([ 'RIP_PROJECT_PATH' => base_path(), 'RIP_VIRTUAL_ID' => $virtual->id, diff --git a/src/Inspector.php b/src/Inspector/Inspector.php similarity index 97% rename from src/Inspector.php rename to src/Inspector/Inspector.php index e6292e5..6ffdaa7 100755 --- a/src/Inspector.php +++ b/src/Inspector/Inspector.php @@ -10,7 +10,7 @@ * Contributions, suggestions, and feedback are always welcome! */ -namespace Laravel\Ripple; +namespace Laravel\Ripple\Inspector; use function base_path; use function Co\channel; diff --git a/src/Octane/Bin/ripple-server.bin.php b/src/Octane/Bin/ripple-server.bin.php index 5339595..4743a07 100755 --- a/src/Octane/Bin/ripple-server.bin.php +++ b/src/Octane/Bin/ripple-server.bin.php @@ -16,7 +16,7 @@ use Laravel\Octane\ApplicationFactory; use Laravel\Octane\RequestContext; use Laravel\Octane\Worker; -use Laravel\Ripple\Factory; +use Laravel\Ripple\Built\Factory; use Laravel\Ripple\HttpWorker; use Laravel\Ripple\Octane\RippleClient; use Laravel\Ripple\Util; diff --git a/src/Octane/Bin/ripple-ware.bin.php b/src/Octane/Bin/ripple-ware.bin.php index 23a6b52..6a4ab72 100755 --- a/src/Octane/Bin/ripple-ware.bin.php +++ b/src/Octane/Bin/ripple-ware.bin.php @@ -14,7 +14,7 @@ use Illuminate\Contracts\Container\BindingResolutionException; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; -use Laravel\Ripple\Factory; +use Laravel\Ripple\Built\Factory; use Laravel\Ripple\Virtual\Virtual; use Ripple\Utils\Output; diff --git a/src/Octane/Commands/RippleStopCommand.php b/src/Octane/Commands/RippleStopCommand.php index 74009d1..fe06a4d 100755 --- a/src/Octane/Commands/RippleStopCommand.php +++ b/src/Octane/Commands/RippleStopCommand.php @@ -14,7 +14,7 @@ use Illuminate\Contracts\Container\BindingResolutionException; use Laravel\Octane\Commands\StopCommand; -use Laravel\Ripple\Inspector; +use Laravel\Ripple\Inspector\Inspector; use Symfony\Component\Console\Attribute\AsCommand; use function app; diff --git a/src/Octane/RippleClient.php b/src/Octane/RippleClient.php index 877a34c..a02a71b 100755 --- a/src/Octane/RippleClient.php +++ b/src/Octane/RippleClient.php @@ -17,7 +17,7 @@ use Laravel\Octane\Contracts\Client; use Laravel\Octane\OctaneResponse; use Laravel\Octane\RequestContext; -use Laravel\Ripple\Response\IteratorResponse; +use Laravel\Ripple\Built\Response\IteratorResponse; use Ripple\Utils\Output; use Symfony\Component\HttpFoundation\BinaryFileResponse; use Throwable; diff --git a/src/Octane/RippleServerProcessInspector.php b/src/Octane/RippleServerProcessInspector.php index ef06253..bbc4f09 100755 --- a/src/Octane/RippleServerProcessInspector.php +++ b/src/Octane/RippleServerProcessInspector.php @@ -13,7 +13,7 @@ namespace Laravel\Ripple\Octane; use Laravel\Octane\Contracts\ServerProcessInspector as ServerProcessInspectorContract; -use Laravel\Ripple\Client; +use Laravel\Ripple\Inspector\Client; /** * @@ -21,7 +21,7 @@ class RippleServerProcessInspector implements ServerProcessInspectorContract { /** - * @param \Laravel\Ripple\Client $client + * @param \Laravel\Ripple\Inspector\Client $client */ public function __construct(protected readonly Client $client) { diff --git a/src/Provider.php b/src/Provider.php index 5ccfba4..58e4d95 100755 --- a/src/Provider.php +++ b/src/Provider.php @@ -14,6 +14,7 @@ use Composer\InstalledVersions; use Illuminate\Support\ServiceProvider; +use Laravel\Ripple\Built\Command; use Laravel\Ripple\Octane\RippleProvider; use function config_path; diff --git a/src/Virtual/server.bin.php b/src/Virtual/server.bin.php index 25cd59d..30a7c6e 100755 --- a/src/Virtual/server.bin.php +++ b/src/Virtual/server.bin.php @@ -14,8 +14,8 @@ use Illuminate\Contracts\Container\BindingResolutionException; use Illuminate\Foundation\Console\Kernel; -use Laravel\Ripple\Coroutine\ContextManager; -use Laravel\Ripple\Factory; +use Laravel\Ripple\Built\Coroutine\ContextManager; +use Laravel\Ripple\Built\Factory; use Laravel\Ripple\HttpWorker; use Laravel\Ripple\Util; use Ripple\Utils\Output;