@trieb.work/nextjs-turbo-redis-cache 1.15.0 → 1.15.1

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.
Files changed (246) hide show
  1. package/.cursor/skills/testing/SKILL.md +121 -0
  2. package/.github/workflows/ci.yml +155 -70
  3. package/ARCHITECTURE.md +431 -0
  4. package/CHANGELOG.md +7 -0
  5. package/README.md +72 -47
  6. package/dist/index.js +78 -14
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +78 -14
  9. package/dist/index.mjs.map +1 -1
  10. package/eslint.config.mjs +1 -1
  11. package/package.json +14 -16
  12. package/playwright.config.ts +5 -3
  13. package/src/CacheComponentsHandler.ts +57 -2
  14. package/src/SyncedMap.ts +62 -13
  15. package/test/README.md +179 -0
  16. package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/package.json +6 -6
  17. package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-15-4-11}/pnpm-lock.yaml +89 -105
  18. package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11}/package.json +3 -3
  19. package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11}/pnpm-lock.yaml +53 -53
  20. package/test/nextjs-test-projects/next-app-16-0-11-cache-components/package.json +28 -0
  21. package/test/nextjs-test-projects/next-app-16-0-11-cache-components/pnpm-lock.yaml +4206 -0
  22. package/test/nextjs-test-projects/next-app-16-2-6/eslint.config.mjs +18 -0
  23. package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6}/package.json +3 -3
  24. package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6}/pnpm-lock.yaml +54 -60
  25. package/test/nextjs-test-projects/next-app-16-2-6/postcss.config.mjs +7 -0
  26. package/test/nextjs-test-projects/next-app-16-2-6/src/app/favicon.ico +0 -0
  27. package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-2-6}/tsconfig.json +9 -2
  28. package/test/nextjs-test-projects/next-app-16-2-6-cache-components/cache-handler.js +3 -0
  29. package/test/nextjs-test-projects/next-app-16-2-6-cache-components/next.config.ts +13 -0
  30. package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-2-6-cache-components}/package.json +3 -3
  31. 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
  32. package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/cached-static-fetch/route.ts +19 -0
  33. package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/cached-with-cachelife/route.ts +24 -0
  34. package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/cached-with-tag/route.ts +21 -0
  35. package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/revalidate-tag/route.ts +19 -0
  36. package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/revalidated-fetch/route.ts +19 -0
  37. package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/cachelife-short/page.tsx +110 -0
  38. package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/page.tsx +90 -0
  39. package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/runtime-data-suspense/page.tsx +127 -0
  40. package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/stale-while-revalidate/page.tsx +130 -0
  41. package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/tag-invalidation/page.tsx +127 -0
  42. package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/use-cache-nondeterministic/page.tsx +110 -0
  43. package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/src/app/layout.tsx +0 -2
  44. package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/update-tag-test/page.tsx +22 -0
  45. package/{tests → test/playwright}/update-tag.spec.ts +1 -1
  46. package/test/{integration → vitest/integration}/build-id-prefix.integration.test.ts +2 -2
  47. package/test/{cache-components/cache-components.integration.spec.ts → vitest/integration/cache-components/cache-components.integration.test.ts} +7 -3
  48. package/test/{cache-components/redis-kill-reconnect.spec.ts → vitest/integration/cache-components/redis-kill-reconnect.test.ts} +28 -7
  49. package/test/vitest/integration/cache-components/redis-quit-vs-disconnect.test.ts +59 -0
  50. package/test/vitest/integration/cache-components/redis-subscriber-outage.test.ts +100 -0
  51. package/test/{cache-components → vitest/integration/cache-components}/scripts/redis-kill-reconnect.ts +31 -8
  52. package/test/vitest/integration/cache-components/scripts/redis-quit-vs-disconnect.ts +113 -0
  53. package/test/vitest/integration/cache-components/scripts/redis-subscriber-outage.ts +379 -0
  54. package/test/vitest/integration/cache-components/scripts/redis-test-helpers.ts +155 -0
  55. package/test/{integration → vitest/integration}/nextjs-cache-handler.integration.test.ts +15 -9
  56. package/test/vitest/unit/SyncedMap-reconnect-repro.test.ts +154 -0
  57. package/{src → test/vitest/unit}/index.test.ts +3 -3
  58. package/test/{cache-components/reconnect-socket-already-opened.spec.ts → vitest/unit/reconnect-socket-already-opened.test.ts} +1 -1
  59. package/{src → test/vitest/unit}/serializer.test.ts +7 -3
  60. package/{src → test/vitest/unit}/utils/prefix.test.ts +1 -1
  61. package/vite.config.ts +4 -3
  62. package/vitest.cache-components.config.ts +1 -1
  63. package/test/browser/update-tag.browser.test.ts +0 -41
  64. package/test/integration/next-app-15-0-3/next.config.js +0 -6
  65. package/test/integration/next-app-15-0-3/package-lock.json +0 -5833
  66. package/test/integration/next-app-15-0-3/pnpm-lock.yaml +0 -3710
  67. package/test/integration/next-app-15-3-2/next.config.js +0 -6
  68. package/test/integration/next-app-15-3-2/package.json +0 -33
  69. package/test/integration/next-app-15-3-2/pnpm-lock.yaml +0 -3720
  70. package/test/integration/next-app-15-3-2/postcss.config.mjs +0 -5
  71. package/test/integration/next-app-15-3-2/src/app/api/revalidateTag/route.ts +0 -15
  72. package/test/integration/next-app-15-4-7/eslint.config.mjs +0 -16
  73. package/test/integration/next-app-15-4-7/package-lock.json +0 -5969
  74. package/test/integration/next-app-15-4-7/package.json +0 -33
  75. package/test/integration/next-app-15-4-7/postcss.config.mjs +0 -5
  76. package/test/integration/next-app-15-4-7/src/app/api/revalidateTag/route.ts +0 -15
  77. package/test/integration/next-app-15-4-7/tsconfig.json +0 -27
  78. package/test/integration/next-app-16-0-3/src/app/api/cached-static-fetch/route.ts +0 -18
  79. package/test/integration/next-app-16-0-3/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -27
  80. package/test/integration/next-app-16-0-3/src/app/api/revalidatePath/route.ts +0 -15
  81. package/test/integration/next-app-16-0-3/src/app/api/revalidated-fetch/route.ts +0 -17
  82. package/test/integration/next-app-16-0-3/src/app/api/uncached-fetch/route.ts +0 -15
  83. package/test/integration/next-app-16-0-3/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -19
  84. package/test/integration/next-app-16-0-3/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -34
  85. package/test/integration/next-app-16-0-3/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
  86. package/test/integration/next-app-16-0-3/src/app/pages/no-fetch/default-page/page.tsx +0 -55
  87. package/test/integration/next-app-16-0-3/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -19
  88. package/test/integration/next-app-16-0-3/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -35
  89. package/test/integration/next-app-16-0-3/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
  90. package/test/integration/next-app-16-0-3/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -19
  91. package/test/integration/next-app-16-0-3/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -32
  92. package/test/integration/next-app-16-0-3/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
  93. package/test/integration/next-app-16-2-3/src/app/api/cached-static-fetch/route.ts +0 -18
  94. package/test/integration/next-app-16-2-3/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -27
  95. package/test/integration/next-app-16-2-3/src/app/api/revalidatePath/route.ts +0 -15
  96. package/test/integration/next-app-16-2-3/src/app/api/revalidated-fetch/route.ts +0 -17
  97. package/test/integration/next-app-16-2-3/src/app/api/uncached-fetch/route.ts +0 -15
  98. package/test/integration/next-app-16-2-3/src/app/globals.css +0 -26
  99. package/test/integration/next-app-16-2-3/src/app/layout.tsx +0 -59
  100. package/test/integration/next-app-16-2-3/src/app/page.tsx +0 -755
  101. package/test/integration/next-app-16-2-3/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -19
  102. package/test/integration/next-app-16-2-3/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -34
  103. package/test/integration/next-app-16-2-3/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
  104. package/test/integration/next-app-16-2-3/src/app/pages/no-fetch/default-page/page.tsx +0 -55
  105. package/test/integration/next-app-16-2-3/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -19
  106. package/test/integration/next-app-16-2-3/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -35
  107. package/test/integration/next-app-16-2-3/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
  108. package/test/integration/next-app-16-2-3/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -19
  109. package/test/integration/next-app-16-2-3/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -32
  110. package/test/integration/next-app-16-2-3/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
  111. package/test/integration/next-app-16-2-3/src/app/revalidation-interface.tsx +0 -267
  112. package/test/integration/next-app-16-2-3-cache-components/public/file.svg +0 -1
  113. package/test/integration/next-app-16-2-3-cache-components/public/globe.svg +0 -1
  114. package/test/integration/next-app-16-2-3-cache-components/public/next.svg +0 -1
  115. package/test/integration/next-app-16-2-3-cache-components/public/vercel.svg +0 -1
  116. package/test/integration/next-app-16-2-3-cache-components/public/window.svg +0 -1
  117. package/test/integration/next-app-customized/README.md +0 -36
  118. package/test/integration/next-app-customized/eslint.config.mjs +0 -16
  119. package/vitest.browser.config.ts +0 -10
  120. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/README.md +0 -0
  121. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/eslint.config.mjs +0 -0
  122. /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-15-4-11}/next.config.js +0 -0
  123. /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-15-4-11}/package-lock.json +0 -0
  124. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/postcss.config.mjs +0 -0
  125. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/public/file.svg +0 -0
  126. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/public/globe.svg +0 -0
  127. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/public/next.svg +0 -0
  128. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/public/vercel.svg +0 -0
  129. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/public/window.svg +0 -0
  130. /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
  131. /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
  132. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/api/revalidatePath/route.ts +0 -0
  133. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/api/revalidateTag/route.ts +0 -0
  134. /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
  135. /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
  136. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/globals.css +0 -0
  137. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/layout.tsx +0 -0
  138. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/page.tsx +0 -0
  139. /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
  140. /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
  141. /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
  142. /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
  143. /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
  144. /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
  145. /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
  146. /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
  147. /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
  148. /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
  149. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/src/app/revalidation-interface.tsx +0 -0
  150. /package/test/{integration/next-app-15-0-3 → nextjs-test-projects/next-app-15-4-11}/tsconfig.json +0 -0
  151. /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-0-11}/README.md +0 -0
  152. /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11}/eslint.config.mjs +0 -0
  153. /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11}/next.config.ts +0 -0
  154. /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11}/postcss.config.mjs +0 -0
  155. /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
  156. /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
  157. /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/api/revalidatePath/route.ts +0 -0
  158. /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11}/src/app/api/revalidateTag/route.ts +0 -0
  159. /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
  160. /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
  161. /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11}/src/app/favicon.ico +0 -0
  162. /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-0-11}/src/app/globals.css +0 -0
  163. /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11}/src/app/layout.tsx +0 -0
  164. /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-0-11}/src/app/page.tsx +0 -0
  165. /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
  166. /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
  167. /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
  168. /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
  169. /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
  170. /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
  171. /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
  172. /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
  173. /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
  174. /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
  175. /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-0-11}/src/app/revalidation-interface.tsx +0 -0
  176. /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
  177. /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-0-11}/tsconfig.json +0 -0
  178. /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/README.md +0 -0
  179. /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
  180. /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11-cache-components}/eslint.config.mjs +0 -0
  181. /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
  182. /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11-cache-components}/postcss.config.mjs +0 -0
  183. /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/public/file.svg +0 -0
  184. /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/public/globe.svg +0 -0
  185. /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/public/next.svg +0 -0
  186. /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/public/vercel.svg +0 -0
  187. /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/public/window.svg +0 -0
  188. /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
  189. /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
  190. /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
  191. /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
  192. /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
  193. /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
  194. /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
  195. /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
  196. /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
  197. /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
  198. /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
  199. /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/favicon.ico +0 -0
  200. /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/globals.css +0 -0
  201. /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
  202. /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-16-0-11-cache-components}/src/app/page.tsx +0 -0
  203. /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
  204. /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
  205. /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-0-11-cache-components}/tsconfig.json +0 -0
  206. /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-2-6}/README.md +0 -0
  207. /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6}/next.config.ts +0 -0
  208. /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
  209. /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
  210. /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/api/revalidatePath/route.ts +0 -0
  211. /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6}/src/app/api/revalidateTag/route.ts +0 -0
  212. /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
  213. /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
  214. /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-2-6}/src/app/globals.css +0 -0
  215. /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6}/src/app/layout.tsx +0 -0
  216. /package/test/{integration/next-app-16-2-3-cache-components → nextjs-test-projects/next-app-16-2-6}/src/app/page.tsx +0 -0
  217. /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
  218. /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
  219. /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
  220. /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
  221. /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
  222. /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
  223. /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
  224. /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
  225. /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
  226. /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
  227. /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
  228. /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
  229. /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/README.md +0 -0
  230. /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/eslint.config.mjs +0 -0
  231. /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/postcss.config.mjs +0 -0
  232. /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6-cache-components}/public/file.svg +0 -0
  233. /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6-cache-components}/public/globe.svg +0 -0
  234. /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6-cache-components}/public/next.svg +0 -0
  235. /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6-cache-components}/public/vercel.svg +0 -0
  236. /package/test/{integration/next-app-15-4-7 → nextjs-test-projects/next-app-16-2-6-cache-components}/public/window.svg +0 -0
  237. /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/src/app/favicon.ico +0 -0
  238. /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/src/app/globals.css +0 -0
  239. /package/test/{integration/next-app-16-0-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/src/app/page.tsx +0 -0
  240. /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
  241. /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-16-2-6-cache-components}/tsconfig.json +0 -0
  242. /package/test/{integration/next-app-16-2-3 → nextjs-test-projects/next-app-customized}/README.md +0 -0
  243. /package/test/{integration → nextjs-test-projects}/next-app-customized/customized-cache-handler.js +0 -0
  244. /package/test/{integration/next-app-15-3-2 → nextjs-test-projects/next-app-customized}/eslint.config.mjs +0 -0
  245. /package/test/{integration → nextjs-test-projects}/next-app-customized/next.config.js +0 -0
  246. /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,5 +0,0 @@
1
- const config = {
2
- plugins: ["@tailwindcss/postcss"],
3
- };
4
-
5
- export default config;
@@ -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,15 +0,0 @@
1
- import { NextResponse } from 'next/server';
2
-
3
- let counter = 0;
4
-
5
- export async function GET() {
6
- counter++;
7
- return NextResponse.json(
8
- { counter },
9
- {
10
- headers: {
11
- 'Cache-Control': 'public, max-age=1',
12
- },
13
- },
14
- );
15
- }
@@ -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,15 +0,0 @@
1
- import { NextResponse } from 'next/server';
2
-
3
- let counter = 0;
4
-
5
- export async function GET() {
6
- counter++;
7
- return NextResponse.json(
8
- { counter },
9
- {
10
- headers: {
11
- 'Cache-Control': 'public, max-age=1',
12
- },
13
- },
14
- );
15
- }
@@ -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
- }