@trieb.work/nextjs-turbo-redis-cache 1.15.0 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/skills/testing/SKILL.md +121 -0
- package/.github/workflows/ci.yml +199 -69
- package/.github/workflows/release.yml +9 -1
- package/ARCHITECTURE.md +431 -0
- package/CHANGELOG.md +28 -0
- package/README.md +77 -49
- package/dist/index.d.mts +71 -45
- package/dist/index.d.ts +71 -45
- package/dist/index.js +107 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +107 -21
- package/dist/index.mjs.map +1 -1
- package/docs/index.html +7 -6
- package/eslint.config.mjs +1 -1
- package/package.json +15 -16
- package/playwright.config.ts +5 -3
- package/src/CacheComponentsHandler.ts +57 -2
- package/src/RedisStringsHandler.ts +125 -66
- package/src/SyncedMap.ts +62 -13
- package/test/README.md +194 -0
- package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/package.json +6 -6
- package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-15-4-11}/pnpm-lock.yaml +89 -105
- package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11}/package.json +3 -3
- package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11}/pnpm-lock.yaml +53 -53
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/package.json +28 -0
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/pnpm-lock.yaml +4206 -0
- package/test/nextjs-test-projects/next-app-16-2-6/eslint.config.mjs +18 -0
- package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6}/package.json +3 -3
- package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6}/pnpm-lock.yaml +54 -60
- package/test/nextjs-test-projects/next-app-16-2-6/postcss.config.mjs +7 -0
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/favicon.ico +0 -0
- package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-2-6}/tsconfig.json +9 -2
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/cache-handler.js +3 -0
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/next.config.ts +13 -0
- package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-2-6-cache-components}/package.json +3 -3
- package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-2-6-cache-components}/pnpm-lock.yaml +54 -60
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/cached-static-fetch/route.ts +19 -0
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/cached-with-cachelife/route.ts +24 -0
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/cached-with-tag/route.ts +21 -0
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/revalidate-tag/route.ts +19 -0
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/revalidated-fetch/route.ts +19 -0
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/cachelife-short/page.tsx +110 -0
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/page.tsx +90 -0
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/runtime-data-suspense/page.tsx +127 -0
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/stale-while-revalidate/page.tsx +130 -0
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/tag-invalidation/page.tsx +127 -0
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/use-cache-nondeterministic/page.tsx +110 -0
- package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/src/app/layout.tsx +0 -2
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/update-tag-test/page.tsx +22 -0
- package/test/nextjs-test-projects/next-pages-16-2-6/README.md +16 -0
- package/test/nextjs-test-projects/next-pages-16-2-6/eslint.config.mjs +18 -0
- package/test/nextjs-test-projects/next-pages-16-2-6/next.config.ts +7 -0
- package/test/nextjs-test-projects/next-pages-16-2-6/package.json +26 -0
- package/test/nextjs-test-projects/next-pages-16-2-6/pnpm-lock.yaml +3896 -0
- package/test/nextjs-test-projects/next-pages-16-2-6/src/pages/api/revalidate.ts +24 -0
- package/test/nextjs-test-projects/next-pages-16-2-6/src/pages/index.tsx +11 -0
- package/test/nextjs-test-projects/next-pages-16-2-6/src/pages/isr/[slug].tsx +49 -0
- package/test/nextjs-test-projects/next-pages-16-2-6/src/pages/static-forever.tsx +20 -0
- package/test/nextjs-test-projects/next-pages-16-2-6/tsconfig.json +34 -0
- package/{tests → test/playwright}/update-tag.spec.ts +1 -1
- package/test/{integration → vitest/integration}/build-id-prefix.integration.test.ts +2 -2
- package/test/{cache-components/cache-components.integration.spec.ts → vitest/integration/cache-components/cache-components.integration.test.ts} +7 -3
- package/test/{cache-components/redis-kill-reconnect.spec.ts → vitest/integration/cache-components/redis-kill-reconnect.test.ts} +28 -7
- package/test/vitest/integration/cache-components/redis-quit-vs-disconnect.test.ts +59 -0
- package/test/vitest/integration/cache-components/redis-subscriber-outage.test.ts +100 -0
- package/test/{cache-components → vitest/integration/cache-components}/scripts/redis-kill-reconnect.ts +31 -8
- package/test/vitest/integration/cache-components/scripts/redis-quit-vs-disconnect.ts +113 -0
- package/test/vitest/integration/cache-components/scripts/redis-subscriber-outage.ts +379 -0
- package/test/vitest/integration/cache-components/scripts/redis-test-helpers.ts +155 -0
- package/test/{integration → vitest/integration}/nextjs-cache-handler.integration.test.ts +15 -9
- package/test/vitest/integration/pages-router.integration.test.ts +420 -0
- package/test/vitest/unit/SyncedMap-reconnect-repro.test.ts +154 -0
- package/{src → test/vitest/unit}/index.test.ts +3 -3
- package/test/vitest/unit/pages-router-kinds.test.ts +292 -0
- package/test/{cache-components/reconnect-socket-already-opened.spec.ts → vitest/unit/reconnect-socket-already-opened.test.ts} +1 -1
- package/{src → test/vitest/unit}/serializer.test.ts +7 -3
- package/{src → test/vitest/unit}/utils/prefix.test.ts +1 -1
- package/vite.config.ts +4 -3
- package/vitest.cache-components.config.ts +1 -1
- package/test/browser/update-tag.browser.test.ts +0 -41
- package/test/integration/next-app-15-0-3/next.config.js +0 -6
- package/test/integration/next-app-15-0-3/package-lock.json +0 -5833
- package/test/integration/next-app-15-0-3/pnpm-lock.yaml +0 -3710
- package/test/integration/next-app-15-3-2/next.config.js +0 -6
- package/test/integration/next-app-15-3-2/package.json +0 -33
- package/test/integration/next-app-15-3-2/pnpm-lock.yaml +0 -3720
- package/test/integration/next-app-15-3-2/postcss.config.mjs +0 -5
- package/test/integration/next-app-15-3-2/src/app/api/revalidateTag/route.ts +0 -15
- package/test/integration/next-app-15-4-7/eslint.config.mjs +0 -16
- package/test/integration/next-app-15-4-7/package-lock.json +0 -5969
- package/test/integration/next-app-15-4-7/package.json +0 -33
- package/test/integration/next-app-15-4-7/postcss.config.mjs +0 -5
- package/test/integration/next-app-15-4-7/src/app/api/revalidateTag/route.ts +0 -15
- package/test/integration/next-app-15-4-7/tsconfig.json +0 -27
- package/test/integration/next-app-16-0-3/src/app/api/cached-static-fetch/route.ts +0 -18
- package/test/integration/next-app-16-0-3/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -27
- package/test/integration/next-app-16-0-3/src/app/api/revalidatePath/route.ts +0 -15
- package/test/integration/next-app-16-0-3/src/app/api/revalidated-fetch/route.ts +0 -17
- package/test/integration/next-app-16-0-3/src/app/api/uncached-fetch/route.ts +0 -15
- package/test/integration/next-app-16-0-3/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/integration/next-app-16-0-3/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -34
- package/test/integration/next-app-16-0-3/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/integration/next-app-16-0-3/src/app/pages/no-fetch/default-page/page.tsx +0 -55
- package/test/integration/next-app-16-0-3/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/integration/next-app-16-0-3/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -35
- package/test/integration/next-app-16-0-3/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/integration/next-app-16-0-3/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/integration/next-app-16-0-3/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -32
- package/test/integration/next-app-16-0-3/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/integration/next-app-16-2-3/src/app/api/cached-static-fetch/route.ts +0 -18
- package/test/integration/next-app-16-2-3/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -27
- package/test/integration/next-app-16-2-3/src/app/api/revalidatePath/route.ts +0 -15
- package/test/integration/next-app-16-2-3/src/app/api/revalidated-fetch/route.ts +0 -17
- package/test/integration/next-app-16-2-3/src/app/api/uncached-fetch/route.ts +0 -15
- package/test/integration/next-app-16-2-3/src/app/globals.css +0 -26
- package/test/integration/next-app-16-2-3/src/app/layout.tsx +0 -59
- package/test/integration/next-app-16-2-3/src/app/page.tsx +0 -755
- package/test/integration/next-app-16-2-3/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/integration/next-app-16-2-3/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -34
- package/test/integration/next-app-16-2-3/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/integration/next-app-16-2-3/src/app/pages/no-fetch/default-page/page.tsx +0 -55
- package/test/integration/next-app-16-2-3/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/integration/next-app-16-2-3/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -35
- package/test/integration/next-app-16-2-3/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/integration/next-app-16-2-3/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/integration/next-app-16-2-3/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -32
- package/test/integration/next-app-16-2-3/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/integration/next-app-16-2-3/src/app/revalidation-interface.tsx +0 -267
- package/test/integration/next-app-16-2-3-cache-components/public/file.svg +0 -1
- package/test/integration/next-app-16-2-3-cache-components/public/globe.svg +0 -1
- package/test/integration/next-app-16-2-3-cache-components/public/next.svg +0 -1
- package/test/integration/next-app-16-2-3-cache-components/public/vercel.svg +0 -1
- package/test/integration/next-app-16-2-3-cache-components/public/window.svg +0 -1
- package/test/integration/next-app-customized/README.md +0 -36
- package/test/integration/next-app-customized/eslint.config.mjs +0 -16
- package/vitest.browser.config.ts +0 -10
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/README.md +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/eslint.config.mjs +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-15-4-11}/next.config.js +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-15-4-11}/package-lock.json +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/postcss.config.mjs +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/public/file.svg +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/public/globe.svg +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/public/next.svg +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/public/vercel.svg +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/public/window.svg +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/api/cached-static-fetch/route.ts +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/api/revalidatePath/route.ts +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/api/revalidateTag/route.ts +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/api/revalidated-fetch/route.ts +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/api/uncached-fetch/route.ts +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/globals.css +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/layout.tsx +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/page.tsx +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/pages/no-fetch/default-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/revalidation-interface.tsx +0 -0
- /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/tsconfig.json +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-0-11}/README.md +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11}/eslint.config.mjs +0 -0
- /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11}/next.config.ts +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11}/postcss.config.mjs +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/api/cached-static-fetch/route.ts +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/api/revalidatePath/route.ts +0 -0
- /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11}/src/app/api/revalidateTag/route.ts +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/api/revalidated-fetch/route.ts +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/api/uncached-fetch/route.ts +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11}/src/app/favicon.ico +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-0-11}/src/app/globals.css +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/layout.tsx +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-0-11}/src/app/page.tsx +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/pages/no-fetch/default-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-0-11}/src/app/revalidation-interface.tsx +0 -0
- /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11}/src/app/update-tag-test/page.tsx +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11}/tsconfig.json +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/README.md +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/cache-handler.js +0 -0
- /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11-cache-components}/eslint.config.mjs +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/next.config.ts +0 -0
- /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11-cache-components}/postcss.config.mjs +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/public/file.svg +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/public/globe.svg +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/public/next.svg +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/public/vercel.svg +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/public/window.svg +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/api/cached-static-fetch/route.ts +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/api/cached-with-cachelife/route.ts +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/api/cached-with-tag/route.ts +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/api/revalidate-tag/route.ts +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/api/revalidated-fetch/route.ts +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/cache-lab/cachelife-short/page.tsx +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/cache-lab/page.tsx +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/cache-lab/runtime-data-suspense/page.tsx +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/cache-lab/stale-while-revalidate/page.tsx +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/cache-lab/tag-invalidation/page.tsx +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/cache-lab/use-cache-nondeterministic/page.tsx +0 -0
- /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/favicon.ico +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/globals.css +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/layout.tsx +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/page.tsx +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/revalidation-interface.tsx +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/update-tag-test/page.tsx +0 -0
- /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11-cache-components}/tsconfig.json +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-2-6}/README.md +0 -0
- /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6}/next.config.ts +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/api/cached-static-fetch/route.ts +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/api/revalidatePath/route.ts +0 -0
- /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6}/src/app/api/revalidateTag/route.ts +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/api/revalidated-fetch/route.ts +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/api/uncached-fetch/route.ts +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-2-6}/src/app/globals.css +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/layout.tsx +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-2-6}/src/app/page.tsx +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/pages/no-fetch/default-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -0
- /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-2-6}/src/app/revalidation-interface.tsx +0 -0
- /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6}/src/app/update-tag-test/page.tsx +0 -0
- /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/README.md +0 -0
- /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/eslint.config.mjs +0 -0
- /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/postcss.config.mjs +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6-cache-components}/public/file.svg +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6-cache-components}/public/globe.svg +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6-cache-components}/public/next.svg +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6-cache-components}/public/vercel.svg +0 -0
- /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6-cache-components}/public/window.svg +0 -0
- /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/src/app/favicon.ico +0 -0
- /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/src/app/globals.css +0 -0
- /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/src/app/page.tsx +0 -0
- /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/src/app/revalidation-interface.tsx +0 -0
- /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/tsconfig.json +0 -0
- /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-customized}/README.md +0 -0
- /package/test/{integration → nextjs-test-projects}/next-app-customized/customized-cache-handler.js +0 -0
- /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-customized}/eslint.config.mjs +0 -0
- /package/test/{integration → nextjs-test-projects}/next-app-customized/next.config.js +0 -0
- /package/{tests → test/playwright}/cache-lab.spec.ts +0 -0
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "next-app",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "export VERCEL_URL=\"dev-test-$RANDOM\" && echo $VERCEL_URL && cd ../../.. && pnpm build && cd test/integration/next-app-15-4-7 && pnpm i && pnpm build && VERCEL_ENV=production REDISHOST=localhost REDISPORT=6379 DEBUG_CACHE_HANDLER=true pnpm start",
|
|
7
|
-
"build": "next build",
|
|
8
|
-
"start": "next start",
|
|
9
|
-
"lint": "next lint"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"react": "19.1.0",
|
|
13
|
-
"react-dom": "19.1.0",
|
|
14
|
-
"next": "15.4.7",
|
|
15
|
-
"redis": "4.7.0",
|
|
16
|
-
"@trieb.work/nextjs-turbo-redis-cache": "file:../../../"
|
|
17
|
-
},
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"typescript": "^5",
|
|
20
|
-
"@types/node": "^20",
|
|
21
|
-
"@types/react": "19.1.3",
|
|
22
|
-
"@types/react-dom": "19.1.3",
|
|
23
|
-
"@tailwindcss/postcss": "^4",
|
|
24
|
-
"tailwindcss": "^4",
|
|
25
|
-
"eslint": "^9",
|
|
26
|
-
"eslint-config-next": "15.4.7",
|
|
27
|
-
"@eslint/eslintrc": "^3"
|
|
28
|
-
},
|
|
29
|
-
"overrides": {
|
|
30
|
-
"@types/react": "19.1.3",
|
|
31
|
-
"@types/react-dom": "19.1.3"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { revalidateTag } from 'next/cache';
|
|
2
|
-
import { NextResponse } from 'next/server';
|
|
3
|
-
|
|
4
|
-
export async function GET(request: Request) {
|
|
5
|
-
const { searchParams } = new URL(request.url);
|
|
6
|
-
const tag = searchParams.get('tag');
|
|
7
|
-
if (!tag) {
|
|
8
|
-
return NextResponse.json(
|
|
9
|
-
{ error: 'Missing tag parameter' },
|
|
10
|
-
{ status: 400 },
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
revalidateTag(tag);
|
|
14
|
-
return NextResponse.json({ success: true });
|
|
15
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2017",
|
|
4
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
-
"allowJs": true,
|
|
6
|
-
"skipLibCheck": true,
|
|
7
|
-
"strict": true,
|
|
8
|
-
"noEmit": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"module": "esnext",
|
|
11
|
-
"moduleResolution": "bundler",
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"isolatedModules": true,
|
|
14
|
-
"jsx": "preserve",
|
|
15
|
-
"incremental": true,
|
|
16
|
-
"plugins": [
|
|
17
|
-
{
|
|
18
|
-
"name": "next"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"paths": {
|
|
22
|
-
"@/*": ["./src/*"]
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
26
|
-
"exclude": ["node_modules"]
|
|
27
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
|
|
3
|
-
let counter = 0;
|
|
4
|
-
|
|
5
|
-
export const dynamic = 'force-static';
|
|
6
|
-
export const revalidate = false;
|
|
7
|
-
|
|
8
|
-
export async function GET() {
|
|
9
|
-
counter++;
|
|
10
|
-
return NextResponse.json(
|
|
11
|
-
{ counter },
|
|
12
|
-
{
|
|
13
|
-
headers: {
|
|
14
|
-
'Cache-Control': 'public, max-age=1',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
);
|
|
18
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
|
|
3
|
-
let counter = 0;
|
|
4
|
-
|
|
5
|
-
export const dynamic = 'force-dynamic';
|
|
6
|
-
|
|
7
|
-
export async function GET() {
|
|
8
|
-
counter++;
|
|
9
|
-
const res = await fetch(
|
|
10
|
-
`http://localhost:${process.env.NEXT_START_PORT || 3000}/api/uncached-fetch`,
|
|
11
|
-
{
|
|
12
|
-
next: {
|
|
13
|
-
revalidate: 3,
|
|
14
|
-
tags: ['revalidated-fetch-revalidate3-nested-fetch-in-api-route'],
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
);
|
|
18
|
-
const data = await res.json();
|
|
19
|
-
return NextResponse.json(
|
|
20
|
-
{ counter, subFetchData: data },
|
|
21
|
-
{
|
|
22
|
-
headers: {
|
|
23
|
-
'Cache-Control': 'public, max-age=1',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { revalidatePath } from 'next/cache';
|
|
2
|
-
import { NextResponse } from 'next/server';
|
|
3
|
-
|
|
4
|
-
export async function GET(request: Request) {
|
|
5
|
-
const { searchParams } = new URL(request.url);
|
|
6
|
-
const path = searchParams.get('path');
|
|
7
|
-
if (!path) {
|
|
8
|
-
return NextResponse.json(
|
|
9
|
-
{ error: 'Missing path parameter' },
|
|
10
|
-
{ status: 400 },
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
revalidatePath(path);
|
|
14
|
-
return NextResponse.json({ success: true });
|
|
15
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
|
|
3
|
-
let counter = 0;
|
|
4
|
-
|
|
5
|
-
export const revalidate = 5;
|
|
6
|
-
|
|
7
|
-
export async function GET() {
|
|
8
|
-
counter++;
|
|
9
|
-
return NextResponse.json(
|
|
10
|
-
{ counter },
|
|
11
|
-
{
|
|
12
|
-
headers: {
|
|
13
|
-
'Cache-Control': 'public, max-age=1',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export const dynamic = 'force-dynamic';
|
|
2
|
-
|
|
3
|
-
export default async function TestPage() {
|
|
4
|
-
const res = await fetch(
|
|
5
|
-
`http://localhost:${process.env.NEXT_START_PORT || 3000}/api/cached-static-fetch`,
|
|
6
|
-
);
|
|
7
|
-
const data = await res.json();
|
|
8
|
-
return (
|
|
9
|
-
<main
|
|
10
|
-
style={{ padding: 32, fontFamily: 'sans-serif', textAlign: 'center' }}
|
|
11
|
-
>
|
|
12
|
-
<h1>Test Page</h1>
|
|
13
|
-
<p>Counter: {data.counter}</p>
|
|
14
|
-
<p>This is a test page for integration testing.</p>
|
|
15
|
-
<p>Timestamp: {Date.now()}</p>
|
|
16
|
-
<p>Slug: /test-page</p>
|
|
17
|
-
</main>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export default async function TestPage() {
|
|
2
|
-
let res;
|
|
3
|
-
try {
|
|
4
|
-
res = await fetch(
|
|
5
|
-
`http://localhost:${process.env.NEXT_START_PORT || 3000}/api/cached-static-fetch`,
|
|
6
|
-
{
|
|
7
|
-
next: {
|
|
8
|
-
revalidate: 15,
|
|
9
|
-
tags: ['cached-static-fetch-revalidate15-default-page'],
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
);
|
|
13
|
-
} catch (e) {
|
|
14
|
-
// ECONNREFUSED is expected during build
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
-
if (((e as Error).cause as any)?.code !== 'ECONNREFUSED') {
|
|
17
|
-
throw e;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const data = res?.ok ? await res.json() : { counter: -1 };
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<main
|
|
25
|
-
style={{ padding: 32, fontFamily: 'sans-serif', textAlign: 'center' }}
|
|
26
|
-
>
|
|
27
|
-
<h1>Test Page</h1>
|
|
28
|
-
<p>Counter: {data.counter}</p>
|
|
29
|
-
<p>This is a test page for integration testing.</p>
|
|
30
|
-
<p>Timestamp: {Date.now()}</p>
|
|
31
|
-
<p>Slug: /test-page</p>
|
|
32
|
-
</main>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export const dynamic = 'force-dynamic';
|
|
2
|
-
|
|
3
|
-
export default async function TestPage() {
|
|
4
|
-
const res = await fetch(
|
|
5
|
-
`http://localhost:${process.env.NEXT_START_PORT || 3000}/api/cached-static-fetch`,
|
|
6
|
-
{
|
|
7
|
-
next: {
|
|
8
|
-
revalidate: 15,
|
|
9
|
-
tags: ['cached-static-fetch-revalidate15-force-dynamic-page'],
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
);
|
|
13
|
-
const data = await res.json();
|
|
14
|
-
return (
|
|
15
|
-
<main
|
|
16
|
-
style={{ padding: 32, fontFamily: 'sans-serif', textAlign: 'center' }}
|
|
17
|
-
>
|
|
18
|
-
<h1>Test Page</h1>
|
|
19
|
-
<p>Counter: {data.counter}</p>
|
|
20
|
-
<p>This is a test page for integration testing.</p>
|
|
21
|
-
<p>Timestamp: {Date.now()}</p>
|
|
22
|
-
<p>Slug: /test-page</p>
|
|
23
|
-
</main>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
export default async function TestPage() {
|
|
2
|
-
await new Promise((r) => setTimeout(r, 1000));
|
|
3
|
-
const rdm = Math.random();
|
|
4
|
-
return (
|
|
5
|
-
<main
|
|
6
|
-
style={{ padding: 32, fontFamily: 'sans-serif', textAlign: 'center' }}
|
|
7
|
-
>
|
|
8
|
-
<h1>Test Page</h1>
|
|
9
|
-
<p>Random number: {rdm}</p>
|
|
10
|
-
<p>This is a test page for integration testing.</p>
|
|
11
|
-
<p>Timestamp: {Date.now()}</p>
|
|
12
|
-
</main>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* TODO
|
|
18
|
-
* Test cases:
|
|
19
|
-
* 0. Store timestamp of the first call in a variable so we can later check if TTL in redis is correct
|
|
20
|
-
* 1. Call the page twice
|
|
21
|
-
* 2. Extract the Timestamp from both results
|
|
22
|
-
* 3. Compare the two timestamps
|
|
23
|
-
* 4. The timestamps should be the same, meaning that the page was deduplicated
|
|
24
|
-
*
|
|
25
|
-
* 5. Connect to redis and check if the page was cached in redis and if TTL is set correctly
|
|
26
|
-
*
|
|
27
|
-
* 6. Call the page again, but wait 3 seconds before calling it
|
|
28
|
-
* 7. Extract the Timestamp
|
|
29
|
-
* 8. Compare the timestamp to previous timestamp
|
|
30
|
-
* 9. The timestamp should be the same, meaning that the page was cached (By in-memory cache which is set to 10 seconds by default)
|
|
31
|
-
*
|
|
32
|
-
* 10. Call the page again, but wait 11 seconds before calling it
|
|
33
|
-
* 11. Extract the Timestamp
|
|
34
|
-
* 12. Compare the timestamp to previous timestamp
|
|
35
|
-
* 13. The timestamp should be the same, meaning that the page was cached (By redis cache which becomes active after in-memory cache expires)
|
|
36
|
-
*
|
|
37
|
-
* 14. Connect to redis and check if the page was cached in redis and if TTL is set correctly
|
|
38
|
-
*
|
|
39
|
-
* 15. Check expiration time of the page in redis
|
|
40
|
-
*
|
|
41
|
-
* 16. Call the page again after TTL expiration time
|
|
42
|
-
* 17. Extract the Timestamp
|
|
43
|
-
* 18. Compare the timestamp to previous timestamp
|
|
44
|
-
* 19. The timestamp should be different, meaning that the page was recreated
|
|
45
|
-
*
|
|
46
|
-
* 20. call API which will invalidate the page via a revalidatePage action
|
|
47
|
-
* 21. Call the page again
|
|
48
|
-
* 18. Compare the timestamp to previous timestamp
|
|
49
|
-
* 19. The timestamp should be different, meaning that the page was recreated
|
|
50
|
-
*
|
|
51
|
-
* 20. Connect to redis and delete the page from redis
|
|
52
|
-
* 21. Call the page again, but wait 11 seconds before calling it
|
|
53
|
-
* 22. Compare the timestamp to previous timestamp
|
|
54
|
-
* 23. The timestamp should be different, meaning that the page was recreated
|
|
55
|
-
*/
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export const dynamic = 'force-dynamic';
|
|
2
|
-
|
|
3
|
-
export default async function TestPage() {
|
|
4
|
-
const res = await fetch(
|
|
5
|
-
`http://localhost:${process.env.NEXT_START_PORT || 3000}/api/revalidated-fetch`,
|
|
6
|
-
);
|
|
7
|
-
const data = await res.json();
|
|
8
|
-
return (
|
|
9
|
-
<main
|
|
10
|
-
style={{ padding: 32, fontFamily: 'sans-serif', textAlign: 'center' }}
|
|
11
|
-
>
|
|
12
|
-
<h1>Test Page</h1>
|
|
13
|
-
<p>Counter: {data.counter}</p>
|
|
14
|
-
<p>This is a test page for integration testing.</p>
|
|
15
|
-
<p>Timestamp: {Date.now()}</p>
|
|
16
|
-
<p>Slug: /test-page</p>
|
|
17
|
-
</main>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// This page will inherit the revalidate from it's subsequent fetch request
|
|
2
|
-
// meaning that the page will be revalidated after 15 seconds
|
|
3
|
-
|
|
4
|
-
export default async function TestPage() {
|
|
5
|
-
try {
|
|
6
|
-
const res = await fetch(
|
|
7
|
-
`http://localhost:${process.env.NEXT_START_PORT || 3000}/api/revalidated-fetch`,
|
|
8
|
-
{
|
|
9
|
-
next: {
|
|
10
|
-
revalidate: 15,
|
|
11
|
-
tags: ['revalidated-fetch-revalidate15-default-page'],
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
);
|
|
15
|
-
const data = await res.json();
|
|
16
|
-
return (
|
|
17
|
-
<main
|
|
18
|
-
style={{ padding: 32, fontFamily: 'sans-serif', textAlign: 'center' }}
|
|
19
|
-
>
|
|
20
|
-
<h1>Test Page</h1>
|
|
21
|
-
<p>Counter: {data.counter}</p>
|
|
22
|
-
<p>This is a test page for integration testing.</p>
|
|
23
|
-
<p>Timestamp: {Date.now()}</p>
|
|
24
|
-
<p>Slug: /test-page</p>
|
|
25
|
-
</main>
|
|
26
|
-
);
|
|
27
|
-
} catch (e) {
|
|
28
|
-
return (
|
|
29
|
-
<p>
|
|
30
|
-
Error: {JSON.stringify(e)} (an error here is normal during build since
|
|
31
|
-
API is not available yet)
|
|
32
|
-
</p>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export const dynamic = 'force-dynamic';
|
|
2
|
-
|
|
3
|
-
export default async function TestPage() {
|
|
4
|
-
const res = await await fetch(
|
|
5
|
-
`http://localhost:${process.env.NEXT_START_PORT || 3000}/api/revalidated-fetch`,
|
|
6
|
-
{
|
|
7
|
-
next: {
|
|
8
|
-
revalidate: 15,
|
|
9
|
-
tags: ['revalidated-fetch-revalidate15-force-dynamic-page'],
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
);
|
|
13
|
-
const data = await res.json();
|
|
14
|
-
return (
|
|
15
|
-
<main
|
|
16
|
-
style={{ padding: 32, fontFamily: 'sans-serif', textAlign: 'center' }}
|
|
17
|
-
>
|
|
18
|
-
<h1>Test Page</h1>
|
|
19
|
-
<p>Counter: {data.counter}</p>
|
|
20
|
-
<p>This is a test page for integration testing.</p>
|
|
21
|
-
<p>Timestamp: {Date.now()}</p>
|
|
22
|
-
<p>Slug: /test-page</p>
|
|
23
|
-
</main>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export const dynamic = 'force-dynamic';
|
|
2
|
-
|
|
3
|
-
export default async function TestPage() {
|
|
4
|
-
const res = await fetch(
|
|
5
|
-
`http://localhost:${process.env.NEXT_START_PORT || 3000}/api/uncached-fetch`,
|
|
6
|
-
);
|
|
7
|
-
const data = await res.json();
|
|
8
|
-
return (
|
|
9
|
-
<main
|
|
10
|
-
style={{ padding: 32, fontFamily: 'sans-serif', textAlign: 'center' }}
|
|
11
|
-
>
|
|
12
|
-
<h1>Test Page</h1>
|
|
13
|
-
<p>Counter: {data.counter}</p>
|
|
14
|
-
<p>This is a test page for integration testing.</p>
|
|
15
|
-
<p>Timestamp: {Date.now()}</p>
|
|
16
|
-
<p>Slug: /test-page</p>
|
|
17
|
-
</main>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export default async function TestPage() {
|
|
2
|
-
try {
|
|
3
|
-
const res = await fetch(
|
|
4
|
-
`http://localhost:${process.env.NEXT_START_PORT || 3000}/api/uncached-fetch`,
|
|
5
|
-
{
|
|
6
|
-
next: {
|
|
7
|
-
revalidate: 15,
|
|
8
|
-
tags: ['uncached-fetch-revalidate15-default-page'],
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
);
|
|
12
|
-
const data = await res.json();
|
|
13
|
-
return (
|
|
14
|
-
<main
|
|
15
|
-
style={{ padding: 32, fontFamily: 'sans-serif', textAlign: 'center' }}
|
|
16
|
-
>
|
|
17
|
-
<h1>Test Page</h1>
|
|
18
|
-
<p>Counter: {data.counter}</p>
|
|
19
|
-
<p>This is a test page for integration testing.</p>
|
|
20
|
-
<p>Timestamp: {Date.now()}</p>
|
|
21
|
-
<p>Slug: /test-page</p>
|
|
22
|
-
</main>
|
|
23
|
-
);
|
|
24
|
-
} catch (e) {
|
|
25
|
-
return (
|
|
26
|
-
<p>
|
|
27
|
-
Error: {JSON.stringify(e)} (an error here is normal during build since
|
|
28
|
-
API is not available yet)
|
|
29
|
-
</p>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export const dynamic = 'force-dynamic';
|
|
2
|
-
|
|
3
|
-
export default async function TestPage() {
|
|
4
|
-
const res = await fetch(
|
|
5
|
-
`http://localhost:${process.env.NEXT_START_PORT || 3000}/api/uncached-fetch`,
|
|
6
|
-
{
|
|
7
|
-
next: {
|
|
8
|
-
revalidate: 15,
|
|
9
|
-
tags: ['uncached-fetch-revalidate15-force-dynamic-page'],
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
);
|
|
13
|
-
const data = await res.json();
|
|
14
|
-
return (
|
|
15
|
-
<main
|
|
16
|
-
style={{ padding: 32, fontFamily: 'sans-serif', textAlign: 'center' }}
|
|
17
|
-
>
|
|
18
|
-
<h1>Test Page</h1>
|
|
19
|
-
<p>Counter: {data.counter}</p>
|
|
20
|
-
<p>This is a test page for integration testing.</p>
|
|
21
|
-
<p>Timestamp: {Date.now()}</p>
|
|
22
|
-
<p>Slug: /test-page</p>
|
|
23
|
-
</main>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
|
|
3
|
-
let counter = 0;
|
|
4
|
-
|
|
5
|
-
export const dynamic = 'force-static';
|
|
6
|
-
export const revalidate = false;
|
|
7
|
-
|
|
8
|
-
export async function GET() {
|
|
9
|
-
counter++;
|
|
10
|
-
return NextResponse.json(
|
|
11
|
-
{ counter },
|
|
12
|
-
{
|
|
13
|
-
headers: {
|
|
14
|
-
'Cache-Control': 'public, max-age=1',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
);
|
|
18
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
|
|
3
|
-
let counter = 0;
|
|
4
|
-
|
|
5
|
-
export const dynamic = 'force-dynamic';
|
|
6
|
-
|
|
7
|
-
export async function GET() {
|
|
8
|
-
counter++;
|
|
9
|
-
const res = await fetch(
|
|
10
|
-
`http://localhost:${process.env.NEXT_START_PORT || 3000}/api/uncached-fetch`,
|
|
11
|
-
{
|
|
12
|
-
next: {
|
|
13
|
-
revalidate: 3,
|
|
14
|
-
tags: ['revalidated-fetch-revalidate3-nested-fetch-in-api-route'],
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
);
|
|
18
|
-
const data = await res.json();
|
|
19
|
-
return NextResponse.json(
|
|
20
|
-
{ counter, subFetchData: data },
|
|
21
|
-
{
|
|
22
|
-
headers: {
|
|
23
|
-
'Cache-Control': 'public, max-age=1',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { revalidatePath } from 'next/cache';
|
|
2
|
-
import { NextResponse } from 'next/server';
|
|
3
|
-
|
|
4
|
-
export async function GET(request: Request) {
|
|
5
|
-
const { searchParams } = new URL(request.url);
|
|
6
|
-
const path = searchParams.get('path');
|
|
7
|
-
if (!path) {
|
|
8
|
-
return NextResponse.json(
|
|
9
|
-
{ error: 'Missing path parameter' },
|
|
10
|
-
{ status: 400 },
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
revalidatePath(path);
|
|
14
|
-
return NextResponse.json({ success: true });
|
|
15
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
|
|
3
|
-
let counter = 0;
|
|
4
|
-
|
|
5
|
-
export const revalidate = 5;
|
|
6
|
-
|
|
7
|
-
export async function GET() {
|
|
8
|
-
counter++;
|
|
9
|
-
return NextResponse.json(
|
|
10
|
-
{ counter },
|
|
11
|
-
{
|
|
12
|
-
headers: {
|
|
13
|
-
'Cache-Control': 'public, max-age=1',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
|
-
|
|
3
|
-
:root {
|
|
4
|
-
--background: #ffffff;
|
|
5
|
-
--foreground: #171717;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
@theme inline {
|
|
9
|
-
--color-background: var(--background);
|
|
10
|
-
--color-foreground: var(--foreground);
|
|
11
|
-
--font-sans: var(--font-geist-sans);
|
|
12
|
-
--font-mono: var(--font-geist-mono);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@media (prefers-color-scheme: dark) {
|
|
16
|
-
:root {
|
|
17
|
-
--background: #0a0a0a;
|
|
18
|
-
--foreground: #ededed;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
body {
|
|
23
|
-
background: var(--background);
|
|
24
|
-
color: var(--foreground);
|
|
25
|
-
font-family: Arial, Helvetica, sans-serif;
|
|
26
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// This layout is used to test the revalidation logic
|
|
2
|
-
// The layout itself will not create any cache entries
|
|
3
|
-
// It will just be used to render a page
|
|
4
|
-
// If the layout itself uses a fetch request, it will be handled the same way as if the page itself would use a fetch request
|
|
5
|
-
// The layout can be revalidated as well by using revalidatePath with the path of the layout file. However, this will not revalidate the subsequent fetch requests
|
|
6
|
-
|
|
7
|
-
import type { Metadata } from 'next';
|
|
8
|
-
import { Geist, Geist_Mono } from 'next/font/google';
|
|
9
|
-
import './globals.css';
|
|
10
|
-
|
|
11
|
-
const geistSans = Geist({
|
|
12
|
-
variable: '--font-geist-sans',
|
|
13
|
-
subsets: ['latin'],
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const geistMono = Geist_Mono({
|
|
17
|
-
variable: '--font-geist-mono',
|
|
18
|
-
subsets: ['latin'],
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export const metadata: Metadata = {
|
|
22
|
-
title: 'Create Next App',
|
|
23
|
-
description: 'Generated by create next app',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export default async function RootLayout({
|
|
27
|
-
children,
|
|
28
|
-
}: Readonly<{
|
|
29
|
-
children: React.ReactNode;
|
|
30
|
-
}>) {
|
|
31
|
-
// let res;
|
|
32
|
-
// try {
|
|
33
|
-
// res = await fetch(`https://httpbin.org/get`, {
|
|
34
|
-
// next: {
|
|
35
|
-
// revalidate: 15,
|
|
36
|
-
// tags: ['httpbin-layout-revalidate15'],
|
|
37
|
-
// },
|
|
38
|
-
// });
|
|
39
|
-
// } catch (e) {
|
|
40
|
-
// // ECONNREFUSED is expected during build
|
|
41
|
-
// // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
-
// if (((e as Error).cause as any)?.code !== 'ECONNREFUSED') {
|
|
43
|
-
// throw e;
|
|
44
|
-
// }
|
|
45
|
-
// }
|
|
46
|
-
|
|
47
|
-
// const data = res?.ok ? await res.json() : { origin: -1 };
|
|
48
|
-
return (
|
|
49
|
-
<html lang="en">
|
|
50
|
-
<body
|
|
51
|
-
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
|
52
|
-
>
|
|
53
|
-
Layout TS: {Date.now()}
|
|
54
|
-
{/* Layout counter: {data.origin} */}
|
|
55
|
-
{children}
|
|
56
|
-
</body>
|
|
57
|
-
</html>
|
|
58
|
-
);
|
|
59
|
-
}
|