From 652388a07d6deb96cd2cebc94dedac3b1825391f Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Mon, 1 Aug 2022 11:40:45 +0200 Subject: [PATCH 1/5] Remove deprecated LegacyPageRouter class from HydeRC --- RELEASE_NOTES.md | 2 +- .../src/Routing/LegacyPageRouter.php | 110 ------------------ 2 files changed, 1 insertion(+), 111 deletions(-) delete mode 100644 packages/realtime-compiler/src/Routing/LegacyPageRouter.php diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index e3d1b60364c..4efb6daf3f9 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -19,7 +19,7 @@ This serves two purposes: - for soon-to-be removed features. ### Removed -- for now removed features. +- Remove the deprecated LegacyPageRouter class from the HydeRC. ### Fixed - for any bug fixes. diff --git a/packages/realtime-compiler/src/Routing/LegacyPageRouter.php b/packages/realtime-compiler/src/Routing/LegacyPageRouter.php deleted file mode 100644 index 23fe84e7b30..00000000000 --- a/packages/realtime-compiler/src/Routing/LegacyPageRouter.php +++ /dev/null @@ -1,110 +0,0 @@ -request = $request; - $this->bootApplication(); - } - - protected function handlePageRequest(): Response - { - $requestPath = $this->normalizePath($this->request->path); - $sourceFilePath = $this->decodeSourceFilePath($requestPath); - $sourceFileModel = $this->decodeSourceFileModel($sourceFilePath); - - $html = $this->getHtml($sourceFileModel, $sourceFilePath); - - return (new Response(200, 'OK', [ - 'body' => $html, - ]))->withHeaders([ - 'Content-Type' => 'text/html', - 'Content-Length' => strlen($html), - ]); - } - - protected function normalizePath(string $path): string - { - // If uri ends in .html, strip it - if (str_ends_with($path, '.html')) { - $path = substr($path, 0, -5); - } - - // If the path is empty, serve the index file - if (empty($path) || $path == '/') { - $path = '/index'; - } - - return $path; - } - - protected function decodeSourceFilePath(string $path): string - { - // Todo get paths from model class instead of hardcoded - if (str_starts_with($path, '/posts/')) { - return '_posts/'.basename($path); - } - - if (str_starts_with($path, '/docs/')) { - return '_docs/'.basename($path); - } - - return '_pages/'.basename($path); - } - - protected function decodeSourceFileModel(string $path): string - { - if (str_starts_with($path, '_posts/')) { - return MarkdownPost::class; - } - - if (str_starts_with($path, '_docs/')) { - return DocumentationPage::class; - } - - if (file_exists(Hyde::path($path.'.md'))) { - return MarkdownPage::class; - } - - return BladePage::class; - } - - protected function getHtml(string $model, string $path): string - { - // todo add caching as we don't need to recompile pages that have not changed - return (new Compiler($model, $path))->render(); - } - - public static function handle(Request $request): Response - { - return (new self($request))->handlePageRequest(); - } -} From a5369f0fe42bc05a9727a50e7a2af647bd5608b5 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Mon, 1 Aug 2022 11:42:49 +0200 Subject: [PATCH 2/5] Remove temporary backwards compatibility for versions under v0.48.0-beta --- RELEASE_NOTES.md | 2 +- packages/realtime-compiler/src/Routing/Router.php | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 4efb6daf3f9..da6f23f1f77 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -13,7 +13,7 @@ This serves two purposes: - for new features. ### Changed -- for changes in existing functionality. +- hyde/realtime-compiler no longer supports Framework versions older than v0.48.0-beta. ### Deprecated - for soon-to-be removed features. diff --git a/packages/realtime-compiler/src/Routing/Router.php b/packages/realtime-compiler/src/Routing/Router.php index 4191ce37449..873645374a0 100644 --- a/packages/realtime-compiler/src/Routing/Router.php +++ b/packages/realtime-compiler/src/Routing/Router.php @@ -46,11 +46,6 @@ public function handle(): Response } } - // Temporary backwards compatibility for versions less than Hyde/Framework v0.48.0-beta - if (! class_exists('\Hyde\Framework\Services\RoutingService')) { - return LegacyPageRouter::handle($this->request); - } - return PageRouter::handle($this->request); } From 1182a41078f6347b40d9d049b7b7ac10a90786a0 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Mon, 1 Aug 2022 11:45:27 +0200 Subject: [PATCH 3/5] Bump minimum suggested framework version to v0.48.0-beta --- packages/realtime-compiler/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/realtime-compiler/composer.json b/packages/realtime-compiler/composer.json index e807eb73ce4..e25777fff79 100644 --- a/packages/realtime-compiler/composer.json +++ b/packages/realtime-compiler/composer.json @@ -21,6 +21,6 @@ "hyde/framework": "dev-master" }, "suggest": { - "hyde/framework": ">=v0.42.0-beta" + "hyde/framework": ">=v0.48.0-beta" } } From 635e5aaebe026fcf7adaf96364500039af90b237 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Mon, 1 Aug 2022 11:46:17 +0200 Subject: [PATCH 4/5] Bump HydeRC --- packages/hyde/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/hyde/composer.json b/packages/hyde/composer.json index fbf7c2d7b89..26e74740768 100644 --- a/packages/hyde/composer.json +++ b/packages/hyde/composer.json @@ -25,7 +25,7 @@ "laravel-zero/framework": "^9.1" }, "require-dev": { - "hyde/realtime-compiler": "^2.4" + "hyde/realtime-compiler": "^2.5" }, "autoload": { "psr-4": { From 7030d68b2a4680380e3184e5ce73328756f81eb3 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Mon, 1 Aug 2022 11:46:21 +0200 Subject: [PATCH 5/5] Update RELEASE_NOTES.md --- RELEASE_NOTES.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index da6f23f1f77..7a145ed94b5 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -2,18 +2,14 @@ ### About -Keep an Unreleased section at the top to track upcoming changes. - -This serves two purposes: - -1. People can see what changes they might expect in upcoming releases -2. At release time, you can move the Unreleased section changes into a new release version section. +This update removes the deprecated LegacyPageRouter class from the Hyde Realtime Compiler (HydeRC). Along with this release, the HydeRC is now on version 2.5, and requires Hyde version 0.48.0-beta or higher. ### Added - for new features. ### Changed - hyde/realtime-compiler no longer supports Framework versions older than v0.48.0-beta. +- hyde/hyde now requires HydeRC version 2.5 or higher. ### Deprecated - for soon-to-be removed features.