@trieb.work/nextjs-turbo-redis-cache 1.11.0-beta.1 → 1.11.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.
Files changed (49) hide show
  1. package/.github/workflows/ci.yml +2 -4
  2. package/.github/workflows/release.yml +14 -0
  3. package/CHANGELOG.md +23 -4
  4. package/README.md +8 -2
  5. package/dist/index.d.mts +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +13 -15
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +13 -15
  10. package/dist/index.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/src/RedisStringsHandler.ts +11 -11
  13. package/src/index.test.ts +10 -4
  14. package/src/index.ts +3 -0
  15. package/test/integration/next-app-16-1-1/README.md +36 -0
  16. package/test/integration/next-app-16-1-1/eslint.config.mjs +18 -0
  17. package/test/integration/next-app-16-1-1/next.config.ts +7 -0
  18. package/test/integration/next-app-16-1-1/package.json +28 -0
  19. package/test/integration/next-app-16-1-1/pnpm-lock.yaml +4128 -0
  20. package/test/integration/next-app-16-1-1/postcss.config.mjs +7 -0
  21. package/test/integration/next-app-16-1-1/src/app/api/cached-static-fetch/route.ts +18 -0
  22. package/test/integration/next-app-16-1-1/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +27 -0
  23. package/test/integration/next-app-16-1-1/src/app/api/revalidatePath/route.ts +15 -0
  24. package/test/integration/next-app-16-1-1/src/app/api/revalidateTag/route.ts +20 -0
  25. package/test/integration/next-app-16-1-1/src/app/api/revalidated-fetch/route.ts +17 -0
  26. package/test/integration/next-app-16-1-1/src/app/api/uncached-fetch/route.ts +15 -0
  27. package/test/integration/next-app-16-1-1/src/app/favicon.ico +0 -0
  28. package/test/integration/next-app-16-1-1/src/app/globals.css +26 -0
  29. package/test/integration/next-app-16-1-1/src/app/layout.tsx +59 -0
  30. package/test/integration/next-app-16-1-1/src/app/page.tsx +755 -0
  31. package/test/integration/next-app-16-1-1/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +19 -0
  32. package/test/integration/next-app-16-1-1/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +34 -0
  33. package/test/integration/next-app-16-1-1/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +25 -0
  34. package/test/integration/next-app-16-1-1/src/app/pages/no-fetch/default-page/page.tsx +55 -0
  35. package/test/integration/next-app-16-1-1/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +19 -0
  36. package/test/integration/next-app-16-1-1/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +35 -0
  37. package/test/integration/next-app-16-1-1/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +25 -0
  38. package/test/integration/next-app-16-1-1/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +19 -0
  39. package/test/integration/next-app-16-1-1/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +32 -0
  40. package/test/integration/next-app-16-1-1/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +25 -0
  41. package/test/integration/next-app-16-1-1/src/app/revalidation-interface.tsx +267 -0
  42. package/test/integration/next-app-16-1-1/src/app/update-tag-test/page.tsx +25 -0
  43. package/test/integration/next-app-16-1-1/tsconfig.json +34 -0
  44. package/.next/trace +0 -11
  45. package/test/integration/next-app-16-1-1-cache-components/public/public/file.svg +0 -1
  46. package/test/integration/next-app-16-1-1-cache-components/public/public/globe.svg +0 -1
  47. package/test/integration/next-app-16-1-1-cache-components/public/public/next.svg +0 -1
  48. package/test/integration/next-app-16-1-1-cache-components/public/public/vercel.svg +0 -1
  49. package/test/integration/next-app-16-1-1-cache-components/public/public/window.svg +0 -1
@@ -7,7 +7,7 @@ on:
7
7
  pull_request:
8
8
  branches:
9
9
  - main
10
-
10
+
11
11
  permissions:
12
12
  contents: write
13
13
  pull-requests: write
@@ -35,7 +35,6 @@ jobs:
35
35
  - next-test-app: next-app-16-0-3
36
36
  run-cache-components: true
37
37
 
38
-
39
38
  steps:
40
39
  - name: Checkout code
41
40
  uses: actions/checkout@v6
@@ -110,7 +109,7 @@ jobs:
110
109
  with:
111
110
  github-token: ${{ secrets.GITHUB_TOKEN }}
112
111
  coverage-file: './coverage/lcov.info'
113
-
112
+
114
113
  - name: Dry run the release
115
114
  if: github.event_name == 'pull_request'
116
115
  env:
@@ -118,4 +117,3 @@ jobs:
118
117
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # NPM token for publishing
119
118
  run: |
120
119
  npx semantic-release --dry-run
121
-
@@ -48,6 +48,19 @@ jobs:
48
48
  NPM_CONFIG_PROVENANCE: 'true'
49
49
  run: pnpm exec semantic-release
50
50
 
51
+ - name: Check if current version is already published
52
+ id: version-check
53
+ env:
54
+ NPM_PACKAGE_NAME: '@trieb.work/nextjs-turbo-redis-cache'
55
+ run: |
56
+ VERSION=$(node -p "require('./package.json').version")
57
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
58
+ if npm view "$NPM_PACKAGE_NAME@$VERSION" version --registry https://registry.npmjs.org/ >/dev/null 2>&1; then
59
+ echo "should_publish=false" >> "$GITHUB_OUTPUT"
60
+ else
61
+ echo "should_publish=true" >> "$GITHUB_OUTPUT"
62
+ fi
63
+
51
64
  - name: Exchange GitHub OIDC token for npm token
52
65
  id: npm-oidc
53
66
  env:
@@ -116,6 +129,7 @@ jobs:
116
129
  NODE
117
130
 
118
131
  - name: Publish to npm (Trusted Publishing)
132
+ if: steps.version-check.outputs.should_publish == 'true'
119
133
  env:
120
134
  NPM_CONFIG_PROVENANCE: 'true'
121
135
  NPM_DIST_TAG: ${{ github.ref_name == 'beta' && 'beta' || 'latest' }}
package/CHANGELOG.md CHANGED
@@ -1,11 +1,30 @@
1
- # [1.11.0-beta.1](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0...v1.11.0-beta.1) (2025-12-30)
1
+ # [1.11.0](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.3...v1.11.0) (2026-02-16)
2
2
 
3
3
 
4
4
  ### Features
5
5
 
6
- * add Next.js 16.0.3 integration test environment and build artifacts for cache components ([f2b3088](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/f2b3088c5845865cb69e5ee691cd09ede5735119))
7
- * add Next.js 16.0.3 integration test environment and build artifacts for cache components ([01fb22a](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/01fb22a9ae0fbbb6fba44bb225ab46fdcc009a85))
8
- * cache components lab + Next.js 16.1.x support ([be2e9b3](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/be2e9b3b7af441df112fc83483994877a4415443))
6
+ * release cache components ([#67](https://github.com/trieb-work/nextjs-turbo-redis-cache/issues/67)) ([815e66b](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/815e66bab21f58d77693cad2a9d73f95ff8e7d79))
7
+
8
+ ## [1.10.3](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.2...v1.10.3) (2026-01-12)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * avoid overlapping redis reconnects ([#58](https://github.com/trieb-work/nextjs-turbo-redis-cache/issues/58)) ([56e3465](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/56e3465669bcf07fa5267226a98977cbddd5ca3d))
14
+
15
+ ## [1.10.2](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.1...v1.10.2) (2026-01-05)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * export CreateRedisStringsHandlerOptions type ([#66](https://github.com/trieb-work/nextjs-turbo-redis-cache/issues/66)) ([48df99f](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/48df99f5f348a464b8af58a0fa46187522aa4688))
21
+
22
+ ## [1.10.1](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0...v1.10.1) (2025-12-31)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * trigger publish and only publish on change ([#64](https://github.com/trieb-work/nextjs-turbo-redis-cache/issues/64)) ([d2a72e9](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/d2a72e9bd203aab13578dfc196c778da64c5046e))
9
28
 
10
29
  # [1.10.0](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.9.1...v1.10.0) (2025-12-27)
11
30
 
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # nextjs-turbo-redis-cache
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@trieb.work/nextjs-turbo-redis-cache.svg)](https://www.npmjs.com/package/@trieb.work/nextjs-turbo-redis-cache)
4
- ![Turbo redis cache image](https://github.com/user-attachments/assets/98e0dfd9-f38a-42ad-a355-9843740cc2d6)
4
+ ![Turbo redis cache image](https://github.com/user-attachments/assets/4103191e-4f4d-4139-a519-0b5bfab3e8b4)
5
5
 
6
6
  The ultimate Redis caching solution for Next.js 15 and the app router. Built for production-ready, large-scale projects, it delivers unparalleled performance and efficiency with features tailored for high-traffic applications. This package has been created after extensibly testing the @neshca package and finding several major issues with it.
7
7
 
@@ -27,8 +27,12 @@ Tested versions are:
27
27
  - Nextjs 15.3.2 + redis client 4.7.0
28
28
  - Nextjs 15.4.7 + redis client 4.7.0
29
29
  - Nextjs 16.0.3 + redis client 4.7.0 (cacheComponents: false)
30
+ - Nextjs 16.1.1 + redis client 4.7.0 (cacheComponents: false)
31
+ - Nextjs 16.1.1 + redis client 4.7.0 (cacheComponents: true)
30
32
 
31
- Currently PPR, 'use cache', cacheLife and cacheTag are not tested. Use these operations with caution and your own risk. [Cache Components](https://nextjs.org/docs/app/getting-started/cache-components) support is in development.
33
+ Currently PPR, 'use cache', cacheLife and cacheTag are not tested. Use these operations with caution and your own risk. [Cache Components](https://nextjs.org/docs/app/getting-started/cache-components) are supported experimentally (Next.js 16+).
34
+
35
+ For Cache Components, see the "Cache Components handler (Next.js 16+)" section below.
32
36
 
33
37
  ## Getting started
34
38
 
@@ -256,6 +260,8 @@ Integration tests may have dependencies between test cases, so individual test f
256
260
 
257
261
  This package can be used as a Cache Components handler (Node.js runtime) for Next.js apps that enable Cache Components.
258
262
 
263
+ This is experimental support and the Next.js Cache Components APIs may still change. We don't have a larger production project right now available to test this in real world conditions.
264
+
259
265
  ### Enable Cache Components + cache handler
260
266
 
261
267
  Install the package in your Next.js app:
package/dist/index.d.mts CHANGED
@@ -170,4 +170,4 @@ type CreateCacheComponentsHandlerOptions = CreateRedisStringsHandlerOptions;
170
170
  declare function getRedisCacheComponentsHandler(options?: CreateCacheComponentsHandlerOptions): CacheComponentsHandler;
171
171
  declare const redisCacheHandler: CacheComponentsHandler;
172
172
 
173
- export { RedisStringsHandler, CachedHandler as default, getRedisCacheComponentsHandler, redisCacheHandler };
173
+ export { type CreateRedisStringsHandlerOptions, RedisStringsHandler, CachedHandler as default, getRedisCacheComponentsHandler, redisCacheHandler };
package/dist/index.d.ts CHANGED
@@ -170,4 +170,4 @@ type CreateCacheComponentsHandlerOptions = CreateRedisStringsHandlerOptions;
170
170
  declare function getRedisCacheComponentsHandler(options?: CreateCacheComponentsHandlerOptions): CacheComponentsHandler;
171
171
  declare const redisCacheHandler: CacheComponentsHandler;
172
172
 
173
- export { RedisStringsHandler, CachedHandler as default, getRedisCacheComponentsHandler, redisCacheHandler };
173
+ export { type CreateRedisStringsHandlerOptions, RedisStringsHandler, CachedHandler as default, getRedisCacheComponentsHandler, redisCacheHandler };
package/dist/index.js CHANGED
@@ -541,15 +541,16 @@ var RedisStringsHandler = class {
541
541
  error,
542
542
  killContainerOnErrorCount++
543
543
  );
544
- setTimeout(
545
- () => this.client.connect().catch((error2) => {
546
- console.error(
547
- "Failed to reconnect Redis client after connection loss:",
548
- error2
549
- );
550
- }),
551
- 1e3
552
- );
544
+ setTimeout(() => {
545
+ if (!this.client.isOpen && !this.client.isReady) {
546
+ this.client.connect().catch((error2) => {
547
+ console.error(
548
+ "Failed to reconnect Redis client after connection loss:",
549
+ error2
550
+ );
551
+ });
552
+ }
553
+ }, 1e3);
553
554
  if (this.killContainerOnErrorThreshold > 0 && killContainerOnErrorCount >= this.killContainerOnErrorThreshold) {
554
555
  console.error(
555
556
  "Redis client error threshold reached, disconnecting and exiting (please implement a restart process/container watchdog to handle this error)",
@@ -565,12 +566,9 @@ var RedisStringsHandler = class {
565
566
  });
566
567
  this.client.connect().then(() => {
567
568
  debug("green", "Redis client connected.");
568
- }).catch(() => {
569
- this.client.connect().catch((error) => {
570
- console.error("Failed to connect Redis client:", error);
571
- this.client.disconnect();
572
- throw error;
573
- });
569
+ }).catch((error) => {
570
+ console.error("Failed to connect Redis client:", error);
571
+ throw error;
574
572
  });
575
573
  } catch (error) {
576
574
  console.error("Failed to initialize Redis client");