From 61301f07ab03b04c2e6d290a17b7ff73a79fd236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 27 Oct 2025 14:28:01 +0100 Subject: [PATCH 1/2] Fix Next.js 16 ssr detection --- src/Detection/Rendering/SSR.php | 2 +- tests/unit/DetectorTest.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Detection/Rendering/SSR.php b/src/Detection/Rendering/SSR.php index b57dc19..0c3b598 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/pages/_app.js'], + 'nextjs' => ['.next/server/webpack-runtime.js', '.next/turbopack'], 'nuxt' => ['server/index.mjs'], 'sveltekit' => ['handler.js'], 'astro' => ['server/entry.mjs'], diff --git a/tests/unit/DetectorTest.php b/tests/unit/DetectorTest.php index 30d9114..90630fb 100644 --- a/tests/unit/DetectorTest.php +++ b/tests/unit/DetectorTest.php @@ -352,7 +352,9 @@ public function testRenderingDetection(array $files, string $framework, string $ public function renderingDataProvider(): array { return [ - [['server/pages/index.html', 'server/pages/api/users.js', '.next/server/pages/_app.js'], 'nextjs', 'ssr', null], + [['server/pages/index.html', 'server/pages/api/users.js', '.next/server/pages/_app.js'], 'nextjs', 'static', null], + [['server/pages/index.html', 'server/pages/api/users.js', '.next/server/turbopack'], 'nextjs', 'ssr', null], + [['server/pages/index.html', 'server/pages/api/users.js', '.next/server/webpack-runtime.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 9b77769fcd26e553d5eb0505674f28fcf2e5be34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 27 Oct 2025 14:33:21 +0100 Subject: [PATCH 2/2] Fix tests --- tests/unit/DetectorTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/unit/DetectorTest.php b/tests/unit/DetectorTest.php index 90630fb..9ab119c 100644 --- a/tests/unit/DetectorTest.php +++ b/tests/unit/DetectorTest.php @@ -352,8 +352,9 @@ public function testRenderingDetection(array $files, string $framework, string $ public function renderingDataProvider(): array { return [ - [['server/pages/index.html', 'server/pages/api/users.js', '.next/server/pages/_app.js'], 'nextjs', 'static', null], - [['server/pages/index.html', 'server/pages/api/users.js', '.next/server/turbopack'], 'nextjs', 'ssr', null], + [['server/pages/index.html', 'server/pages/api/users.js', '.next/server/unrelated-file.js'], 'nextjs', 'static', 'server/pages/index.html'], + [['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], [['index.html', 'about.html', '404.html'], 'nextjs', 'static', null], [['nitro.json', 'server/index.mjs'], 'nuxt', 'ssr', null],