@trieb.work/nextjs-turbo-redis-cache 1.9.1 → 1.10.0-beta.14

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 (45) hide show
  1. package/.github/workflows/ci.yml +14 -2
  2. package/.github/workflows/release.yml +85 -7
  3. package/CHANGELOG.md +117 -0
  4. package/README.md +3 -1
  5. package/dist/index.js +13 -15
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +13 -15
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +15 -11
  10. package/playwright.config.ts +9 -0
  11. package/release.config.cjs +3 -3
  12. package/src/RedisStringsHandler.ts +11 -11
  13. package/test/browser/update-tag.browser.test.ts +41 -0
  14. package/test/integration/next-app-16-0-3/README.md +36 -0
  15. package/test/integration/next-app-16-0-3/eslint.config.mjs +18 -0
  16. package/test/integration/next-app-16-0-3/next.config.ts +7 -0
  17. package/test/integration/next-app-16-0-3/package.json +28 -0
  18. package/test/integration/next-app-16-0-3/pnpm-lock.yaml +4127 -0
  19. package/test/integration/next-app-16-0-3/postcss.config.mjs +7 -0
  20. package/test/integration/next-app-16-0-3/src/app/api/cached-static-fetch/route.ts +18 -0
  21. package/test/integration/next-app-16-0-3/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +27 -0
  22. package/test/integration/next-app-16-0-3/src/app/api/revalidatePath/route.ts +15 -0
  23. package/test/integration/next-app-16-0-3/src/app/api/revalidateTag/route.ts +20 -0
  24. package/test/integration/next-app-16-0-3/src/app/api/revalidated-fetch/route.ts +17 -0
  25. package/test/integration/next-app-16-0-3/src/app/api/uncached-fetch/route.ts +15 -0
  26. package/test/integration/next-app-16-0-3/src/app/favicon.ico +0 -0
  27. package/test/integration/next-app-16-0-3/src/app/globals.css +26 -0
  28. package/test/integration/next-app-16-0-3/src/app/layout.tsx +59 -0
  29. package/test/integration/next-app-16-0-3/src/app/page.tsx +755 -0
  30. package/test/integration/next-app-16-0-3/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +19 -0
  31. package/test/integration/next-app-16-0-3/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +34 -0
  32. package/test/integration/next-app-16-0-3/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +25 -0
  33. package/test/integration/next-app-16-0-3/src/app/pages/no-fetch/default-page/page.tsx +55 -0
  34. package/test/integration/next-app-16-0-3/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +19 -0
  35. package/test/integration/next-app-16-0-3/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +35 -0
  36. package/test/integration/next-app-16-0-3/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +25 -0
  37. package/test/integration/next-app-16-0-3/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +19 -0
  38. package/test/integration/next-app-16-0-3/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +32 -0
  39. package/test/integration/next-app-16-0-3/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +25 -0
  40. package/test/integration/next-app-16-0-3/src/app/revalidation-interface.tsx +267 -0
  41. package/test/integration/next-app-16-0-3/src/app/update-tag-test/page.tsx +25 -0
  42. package/test/integration/next-app-16-0-3/tsconfig.json +34 -0
  43. package/test/integration/nextjs-cache-handler.integration.test.ts +81 -24
  44. package/tests/update-tag.spec.ts +33 -0
  45. package/vitest.browser.config.ts +10 -0
@@ -29,16 +29,18 @@ jobs:
29
29
  - next-app-15-0-3
30
30
  - next-app-15-3-2
31
31
  - next-app-15-4-7
32
+ - next-app-16-0-3
33
+
32
34
 
33
35
  steps:
34
36
  - name: Checkout code
35
- uses: actions/checkout@v3
37
+ uses: actions/checkout@v6
36
38
 
37
39
  - name: Install pnpm
38
40
  run: corepack enable
39
41
 
40
42
  - name: Setup Node.js
41
- uses: actions/setup-node@v3
43
+ uses: actions/setup-node@v6
42
44
  with:
43
45
  node-version: '20'
44
46
  cache: 'pnpm'
@@ -76,6 +78,16 @@ jobs:
76
78
  SKIP_BUILD: true
77
79
  NEXT_TEST_APP: ${{ matrix.next-test-app }}
78
80
 
81
+ - name: Install Playwright browsers (Next 16 only)
82
+ if: matrix.next-test-app == 'next-app-16-0-3'
83
+ run: pnpm exec playwright install --with-deps
84
+
85
+ - name: Run Playwright E2E tests (Next 16 only)
86
+ if: matrix.next-test-app == 'next-app-16-0-3'
87
+ run: pnpm test:e2e
88
+ env:
89
+ PLAYWRIGHT_BASE_URL: http://localhost:3055
90
+
79
91
  - name: Code Coverage Comments
80
92
  if: github.event_name == 'pull_request'
81
93
  uses: kcjpop/coverage-comments@v2.2
@@ -15,6 +15,7 @@ permissions:
15
15
  issues: write
16
16
  actions: write
17
17
  discussions: write
18
+ id-token: write
18
19
 
19
20
  jobs:
20
21
  release:
@@ -22,25 +23,102 @@ jobs:
22
23
 
23
24
  steps:
24
25
  - name: Checkout code
25
- uses: actions/checkout@v3
26
+ uses: actions/checkout@v6
26
27
 
27
28
  - name: Install pnpm
28
29
  run: corepack enable
29
30
 
30
31
  - name: Setup Node.js
31
- uses: actions/setup-node@v3
32
+ uses: actions/setup-node@v6
32
33
  with:
33
- node-version: '20'
34
+ node-version: '22'
34
35
  cache: 'pnpm'
35
36
 
36
37
  - name: Install dependencies
37
- run: pnpm install
38
+ run: pnpm install --frozen-lockfile
39
+ - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
40
+ run: npm audit signatures
38
41
 
39
42
  - name: Build project
40
- run: pnpm run build
43
+ run: pnpm build
41
44
 
42
45
  - name: Run Semantic Release
43
46
  env:
44
47
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token for Semantic Release
45
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # NPM token for publishing
46
- run: npx semantic-release
48
+ NPM_CONFIG_PROVENANCE: 'true'
49
+ run: pnpm exec semantic-release
50
+
51
+ - name: Exchange GitHub OIDC token for npm token
52
+ id: npm-oidc
53
+ env:
54
+ NPM_PACKAGE_NAME: '@trieb.work/nextjs-turbo-redis-cache'
55
+ run: |
56
+ node <<'NODE'
57
+ const fs = require('node:fs');
58
+
59
+ const pkg = process.env.NPM_PACKAGE_NAME;
60
+ const reqUrl = process.env.ACTIONS_ID_TOKEN_REQUEST_URL;
61
+ const reqToken = process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;
62
+
63
+ if (!pkg || !reqUrl || !reqToken) {
64
+ console.error('Missing required env for OIDC token retrieval');
65
+ process.exit(1);
66
+ }
67
+
68
+ const audience = 'npm:registry.npmjs.org';
69
+ const url = reqUrl + (reqUrl.includes('?') ? '&' : '?') + 'audience=' + encodeURIComponent(audience);
70
+
71
+ (async () => {
72
+ const idRes = await fetch(url, { headers: { Authorization: 'Bearer ' + reqToken } });
73
+ if (!idRes.ok) {
74
+ console.error('Failed to fetch GitHub OIDC token:', idRes.status, await idRes.text());
75
+ process.exit(1);
76
+ }
77
+
78
+ const idBody = await idRes.json();
79
+ const idToken = idBody.value;
80
+
81
+ const exUrl =
82
+ 'https://registry.npmjs.org/-/npm/v1/oidc/token/exchange/package/' + encodeURIComponent(pkg);
83
+ const exRes = await fetch(exUrl, {
84
+ method: 'POST',
85
+ headers: { Authorization: 'Bearer ' + idToken },
86
+ });
87
+
88
+ const exText = await exRes.text();
89
+ if (!exRes.ok) {
90
+ console.error('OIDC token exchange with npm failed:', exRes.status, exText);
91
+ process.exit(1);
92
+ }
93
+
94
+ const exBody = JSON.parse(exText);
95
+ const npmToken = exBody.token;
96
+ if (!npmToken) {
97
+ console.error('npm exchange response missing token');
98
+ process.exit(1);
99
+ }
100
+
101
+ fs.appendFileSync(process.env.GITHUB_OUTPUT, `node_auth_token=${npmToken}\n`);
102
+ const npmrcPath = `${process.env.RUNNER_TEMP}/npmrc`;
103
+ const npmrc = [
104
+ 'registry=https://registry.npmjs.org/',
105
+ 'always-auth=true',
106
+ '//registry.npmjs.org/:_authToken=' + npmToken,
107
+ '',
108
+ ].join('\n');
109
+ fs.writeFileSync(npmrcPath, npmrc, { encoding: 'utf8' });
110
+ fs.appendFileSync(process.env.GITHUB_OUTPUT, `npmrc_path=${npmrcPath}\n`);
111
+ console.log('OIDC token exchange with npm registry succeeded');
112
+ })().catch((e) => {
113
+ console.error(e);
114
+ process.exit(1);
115
+ });
116
+ NODE
117
+
118
+ - name: Publish to npm (Trusted Publishing)
119
+ env:
120
+ NPM_CONFIG_PROVENANCE: 'true'
121
+ NPM_DIST_TAG: ${{ github.ref_name == 'beta' && 'beta' || 'latest' }}
122
+ NPM_CONFIG_USERCONFIG: ${{ steps.npm-oidc.outputs.npmrc_path }}
123
+ run: npm publish --provenance --access public --tag $NPM_DIST_TAG --registry https://registry.npmjs.org/
124
+
package/CHANGELOG.md CHANGED
@@ -1,3 +1,120 @@
1
+ # [1.10.0-beta.14](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.13...v1.10.0-beta.14) (2025-12-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * remove extensive debugging and simplify npm publish step in release workflow ([d3b7aa9](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/d3b7aa9fa13d9ff65e2b34e1e49433507cfb9cb2))
7
+
8
+ # [1.10.0-beta.13](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.12...v1.10.0-beta.13) (2025-12-27)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * add comprehensive debugging and .npmrc configuration for npm trusted publishing ([8d4fabb](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/8d4fabb02062a7a771693277909555671e810835))
14
+
15
+ # [1.10.0-beta.12](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.11...v1.10.0-beta.12) (2025-12-27)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * implement OIDC token exchange for npm trusted publishing in release workflow ([3b3cea1](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/3b3cea152dfb183e918dac1b34c6a8277c300474))
21
+
22
+ # [1.10.0-beta.11](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.10...v1.10.0-beta.11) (2025-12-27)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * add diagnostics step to debug OIDC and npm configuration in release workflow ([6a7f3cf](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/6a7f3cf7cda23d57acb34d3bb4c4dd6ab7103ca7))
28
+
29
+ # [1.10.0-beta.10](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.9...v1.10.0-beta.10) (2025-12-27)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * add provenance, public access, and verbose logging to npm publish command ([2fccf3d](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/2fccf3d12c899e5aee38ea5d7c0cdce22dd83ce4))
35
+
36
+ # [1.10.0-beta.9](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.8...v1.10.0-beta.9) (2025-12-27)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * add git+ prefix to repository URL in package.json ([70f94df](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/70f94dff5059808eb4a2376950f3bb9fecb4511e))
42
+
43
+ # [1.10.0-beta.8](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.7...v1.10.0-beta.8) (2025-12-27)
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * disable semantic-release npm publishing and add manual npm publish step with trusted publishing ([4cbf99d](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/4cbf99de560a6a466b5d10f945bd9640356ef444))
49
+
50
+ # [1.10.0-beta.7](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.6...v1.10.0-beta.7) (2025-12-26)
51
+
52
+
53
+ ### Bug Fixes
54
+
55
+ * remove empty auth token environment variables from release workflow ([8d4e87b](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/8d4e87b301842842cd3d0c0a8cb8401dbf100fa9))
56
+
57
+ # [1.10.0-beta.6](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.5...v1.10.0-beta.6) (2025-12-26)
58
+
59
+
60
+ ### Bug Fixes
61
+
62
+ * upgrade semantic-release and related dependencies to v25 ([63fd812](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/63fd812bc0815aa5155619faf9b36b9287daac21))
63
+ * use pnpm exec instead of pnpx for semantic-release command ([ca310c0](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/ca310c0e1b4150052787eba1709152d606d2d76d))
64
+
65
+ # [1.10.0-beta.5](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.4...v1.10.0-beta.5) (2025-12-26)
66
+
67
+
68
+ ### Bug Fixes
69
+
70
+ * remove registry-url and clear auth tokens in release workflow ([b0d9edb](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/b0d9edb4e8efa37500a4dfe4054a24f55582e60e))
71
+
72
+ # [1.10.0-beta.4](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.3...v1.10.0-beta.4) (2025-12-26)
73
+
74
+
75
+ ### Bug Fixes
76
+
77
+ * trigger beta release ([724ecbb](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/724ecbb6d76697818a2c6a863c98e144eed049d2))
78
+
79
+ # [1.10.0-beta.3](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.2...v1.10.0-beta.3) (2025-12-26)
80
+
81
+
82
+ ### Bug Fixes
83
+
84
+ * configure npm provenance in package.json publishConfig ([83a3017](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/83a301797396e98b739db199bfb3e97ee1c8565e))
85
+
86
+ # [1.10.0-beta.2](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.10.0-beta.1...v1.10.0-beta.2) (2025-12-26)
87
+
88
+
89
+ ### Bug Fixes
90
+
91
+ * trigger beta release ([432b58f](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/432b58f661db20e5a8302d54679b16cc33a6dfb6))
92
+
93
+ # [1.10.0-beta.1](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.9.1...v1.10.0-beta.1) (2025-12-26)
94
+
95
+
96
+ ### Bug Fixes
97
+
98
+ * avoid overlapping redis reconnects ([4da291f](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/4da291f1a62ef8ffd9a8528640ee57b1367d0e25))
99
+ * cleanup ([c948fdf](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/c948fdfe0e6b5f70edc985b3cdda9cf2f002633a))
100
+ * folder structure ([93356fd](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/93356fd567c0f05fad92d3443da77216fd2cc28d))
101
+ * just testing around ([09bd26d](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/09bd26dc7b328945f11818a11446b3e5dd86c943))
102
+ * remove not needed attributes ([6c11e0d](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/6c11e0d574e6ae8d98c60f71ea70070415de9de7))
103
+ * testing with npm ([fa7ecb0](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/fa7ecb0283c2611918a3f780bc0c87cf2b28d5db))
104
+ * trigger beta release ([62ea418](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/62ea4182b65fac53f23a93418b9f4650ab717b60))
105
+
106
+
107
+ ### Features
108
+
109
+ * add Next.js 16.0.3 support with new caching API tests ([8a55040](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/8a55040dbecf564fc4d08c04ee35af7e727d2e30))
110
+ * add Playwright E2E tests to CI workflow for Next.js 16 ([4cde821](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/4cde821ed86bd5d1387751bb85922ada9d890199))
111
+ * add support for Next.js 16.0.3 (WIP) ([e873fe0](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/e873fe08e9659515fd7416c3805be5a3c074538d))
112
+ * adding 16-0.3 ([38923b2](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/38923b299a9600659d2ee6245cf01b702eeba33a))
113
+ * extend Next.js peer dependency support to version 16.0.3 ([4e63a5b](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/4e63a5b3270c1696112b532173a7f6d79711576a))
114
+ * extend Next.js peer dependency support to version 16.0.3 ([ffaa08a](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/ffaa08ac79df7345ea289dad3c0f921ec859cb8f))
115
+ * install Playwright browsers before running E2E tests in CI ([d74231a](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/d74231a4bdcf8d3ba90e5c7ee31008540c4a137e))
116
+ * migrate from Vitest browser mode to Playwright for E2E testing ([6c39c98](https://github.com/trieb-work/nextjs-turbo-redis-cache/commit/6c39c989a89625f1835b7b257328b7a5ec45de3c))
117
+
1
118
  ## [1.9.1](https://github.com/trieb-work/nextjs-turbo-redis-cache/compare/v1.9.0...v1.9.1) (2025-11-24)
2
119
 
3
120
 
package/README.md CHANGED
@@ -25,8 +25,10 @@ Tested versions are:
25
25
  - Nextjs 15.0.3 + redis client 4.7.0
26
26
  - Nextjs 15.2.4 + redis client 4.7.0
27
27
  - Nextjs 15.3.2 + redis client 4.7.0
28
+ - Nextjs 15.4.7 + redis client 4.7.0
29
+ - Nextjs 16.0.3 + redis client 4.7.0 (cacheComponents: false)
28
30
 
29
- Currently PPR, 'use cache', cacheLife and cacheTag are not tested. Use these operations with caution and your own risk.
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.
30
32
 
31
33
  ## Getting started
32
34
 
package/dist/index.js CHANGED
@@ -539,15 +539,16 @@ var RedisStringsHandler = class {
539
539
  error,
540
540
  killContainerOnErrorCount++
541
541
  );
542
- setTimeout(
543
- () => this.client.connect().catch((error2) => {
544
- console.error(
545
- "Failed to reconnect Redis client after connection loss:",
546
- error2
547
- );
548
- }),
549
- 1e3
550
- );
542
+ setTimeout(() => {
543
+ if (!this.client.isOpen && !this.client.isReady) {
544
+ this.client.connect().catch((error2) => {
545
+ console.error(
546
+ "Failed to reconnect Redis client after connection loss:",
547
+ error2
548
+ );
549
+ });
550
+ }
551
+ }, 1e3);
551
552
  if (this.killContainerOnErrorThreshold > 0 && killContainerOnErrorCount >= this.killContainerOnErrorThreshold) {
552
553
  console.error(
553
554
  "Redis client error threshold reached, disconnecting and exiting (please implement a restart process/container watchdog to handle this error)",
@@ -563,12 +564,9 @@ var RedisStringsHandler = class {
563
564
  });
564
565
  this.client.connect().then(() => {
565
566
  debug("green", "Redis client connected.");
566
- }).catch(() => {
567
- this.client.connect().catch((error) => {
568
- console.error("Failed to connect Redis client:", error);
569
- this.client.disconnect();
570
- throw error;
571
- });
567
+ }).catch((error) => {
568
+ console.error("Failed to connect Redis client:", error);
569
+ throw error;
572
570
  });
573
571
  } catch (error) {
574
572
  console.error("Failed to initialize Redis client");