From 06a0ea78e94f4af415cb1eb4ec8f5c0e34518280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 30 Oct 2025 14:07:17 +0100 Subject: [PATCH 1/4] Support for next.js standalone build --- src/Detection/Rendering/SSR.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Detection/Rendering/SSR.php b/src/Detection/Rendering/SSR.php index 0c3b598..f6443e5 100644 --- a/src/Detection/Rendering/SSR.php +++ b/src/Detection/Rendering/SSR.php @@ -7,7 +7,7 @@ class SSR extends Rendering { private const FRAMEWORK_FILES = [ - 'nextjs' => ['.next/server/webpack-runtime.js', '.next/turbopack'], + 'nextjs' => ['.next/server/webpack-runtime.js', '.next/turbopack', './server.js'], 'nuxt' => ['server/index.mjs'], 'sveltekit' => ['handler.js'], 'astro' => ['server/entry.mjs'], From 24a8961ee4c7d4b63130fbda715c65fce75b1843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 30 Oct 2025 14:23:20 +0100 Subject: [PATCH 2/4] Apply suggestion from @Meldiron --- src/Detection/Rendering/SSR.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Detection/Rendering/SSR.php b/src/Detection/Rendering/SSR.php index f6443e5..29a097f 100644 --- a/src/Detection/Rendering/SSR.php +++ b/src/Detection/Rendering/SSR.php @@ -7,7 +7,7 @@ class SSR extends Rendering { private const FRAMEWORK_FILES = [ - 'nextjs' => ['.next/server/webpack-runtime.js', '.next/turbopack', './server.js'], + 'nextjs' => ['.next/server/webpack-runtime.js', '.next/turbopack', 'server.js'], 'nuxt' => ['server/index.mjs'], 'sveltekit' => ['handler.js'], 'astro' => ['server/entry.mjs'], From bd23ea2f672db0bb569647b9519dcfbfe7be6181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 30 Oct 2025 14:33:07 +0100 Subject: [PATCH 3/4] update tests --- tests/unit/DetectorTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/DetectorTest.php b/tests/unit/DetectorTest.php index 9ab119c..8a10bee 100644 --- a/tests/unit/DetectorTest.php +++ b/tests/unit/DetectorTest.php @@ -356,6 +356,7 @@ public function renderingDataProvider(): array [['server/pages/api/users.js', '.next/server/pages/_app.js'], 'nextjs', 'static', null], [['server/pages/index.html', 'server/pages/api/users.js', '.next/turbopack'], 'nextjs', 'ssr', null], [['server/pages/index.html', 'server/pages/api/users.js', '.next/server/webpack-runtime.js'], 'nextjs', 'ssr', null], + [['.next/some-standalone-files.js', 'server.js'], 'nextjs', 'ssr', null], [['index.html', 'about.html', '404.html'], 'nextjs', 'static', null], [['nitro.json', 'server/index.mjs'], 'nuxt', 'ssr', null], [['server/server.mjs'], 'angular', 'ssr', null], From 9833d95f6f04d6df72bde9d82505e1eb54e23f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Fri, 31 Oct 2025 13:40:25 +0100 Subject: [PATCH 4/4] Improve tests --- tests/unit/DetectorTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/unit/DetectorTest.php b/tests/unit/DetectorTest.php index 8a10bee..f045904 100644 --- a/tests/unit/DetectorTest.php +++ b/tests/unit/DetectorTest.php @@ -357,6 +357,12 @@ public function renderingDataProvider(): array [['server/pages/index.html', 'server/pages/api/users.js', '.next/turbopack'], 'nextjs', 'ssr', null], [['server/pages/index.html', 'server/pages/api/users.js', '.next/server/webpack-runtime.js'], 'nextjs', 'ssr', null], [['.next/some-standalone-files.js', 'server.js'], 'nextjs', 'ssr', null], + + // Ensure server.js detection from Next.js doesn't interfere with other frameworks + [['nuxt.config.js', 'server/index.mjs', 'server.js'], 'nuxt', 'ssr', null], + [['nuxt.config.js', 'index.html', 'server.js'], 'nuxt', 'static', 'index.html'], + [['nuxt.config.js', '200.html', '202.html', 'server.js'], 'nuxt', 'static', null], + [['index.html', 'about.html', '404.html'], 'nextjs', 'static', null], [['nitro.json', 'server/index.mjs'], 'nuxt', 'ssr', null], [['server/server.mjs'], 'angular', 'ssr', null],