@opennextjs/aws 4.1.13 → 4.1.15

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/dist/adapters/cache.d.ts +21 -1
  2. package/dist/adapters/cache.js +138 -30
  3. package/dist/adapters/composable-cache.d.ts +20 -0
  4. package/dist/adapters/composable-cache.js +33 -8
  5. package/dist/adapters/config/index.js +14 -4
  6. package/dist/adapters/config/util.d.ts +19 -0
  7. package/dist/adapters/config/util.js +21 -0
  8. package/dist/adapters/edge-adapter.js +2 -11
  9. package/dist/adapters/image-optimization-adapter.js +8 -2
  10. package/dist/build/createAssets.d.ts +3 -0
  11. package/dist/build/createAssets.js +11 -8
  12. package/dist/build/createImageOptimizationBundle.js +0 -1
  13. package/dist/build/helper.js +1 -1
  14. package/dist/build/installDeps.js +6 -7
  15. package/dist/build/patch/patches/patchNextServer.d.ts +25 -0
  16. package/dist/build/patch/patches/patchNextServer.js +48 -0
  17. package/dist/core/requestHandler.js +5 -0
  18. package/dist/core/resolve.d.ts +8 -1
  19. package/dist/core/revalidate.d.ts +68 -0
  20. package/dist/core/revalidate.js +143 -0
  21. package/dist/core/routing/cacheInterceptor.js +27 -4
  22. package/dist/core/routing/matcher.js +16 -4
  23. package/dist/core/routing/middleware.d.ts +4 -0
  24. package/dist/core/routing/middleware.js +19 -0
  25. package/dist/core/routing/routeParamPlaceholder.d.ts +14 -0
  26. package/dist/core/routing/routeParamPlaceholder.js +42 -0
  27. package/dist/core/routingHandler.js +8 -2
  28. package/dist/core/util.js +5 -0
  29. package/dist/http/framing.d.ts +35 -0
  30. package/dist/http/framing.js +181 -0
  31. package/dist/http/util.d.ts +11 -0
  32. package/dist/http/util.js +26 -0
  33. package/dist/overrides/cdnInvalidation/cloudfront.js +2 -1
  34. package/dist/overrides/proxyExternalRequest/fetch.js +5 -1
  35. package/dist/overrides/proxyExternalRequest/node.js +5 -0
  36. package/dist/overrides/wrappers/express-dev.js +3 -5
  37. package/dist/overrides/wrappers/node.js +2 -3
  38. package/dist/plugins/edge.js +3 -2
  39. package/dist/types/cache.d.ts +12 -4
  40. package/dist/types/global.d.ts +7 -0
  41. package/dist/types/open-next.d.ts +4 -1
  42. package/dist/types/overrides.d.ts +47 -0
  43. package/dist/utils/cache.d.ts +14 -0
  44. package/dist/utils/cache.js +21 -1
  45. package/package.json +3 -3
@@ -1,6 +1,26 @@
1
+ import { Buffer } from "node:buffer";
2
+ import { createHash } from "node:crypto";
1
3
  import { debug } from "../adapters/logger";
2
4
  import { CACHE_TAGS_HEADER } from "./cacheHeaders";
3
5
  import { compareSemver } from "./semver";
6
+ /**
7
+ * Computes the key used to store a composable (`"use cache"`) entry.
8
+ *
9
+ * The cache key provided by Next.js embeds the serialized arguments of the cached function and may
10
+ * contain any UTF-16 string. Storage backends transform keys (path normalization, URL parsing,
11
+ * UTF-8 encoding, ...) which could map distinct Next.js keys to the same stored entry.
12
+ *
13
+ * The storage key is the sha256 of the exact UTF-16 code units of the cache key, as a 64 characters
14
+ * lowercase hex string that every backend can store as is.
15
+ *
16
+ * @param cacheKey The cache key provided by Next.js
17
+ * @returns The key to use for the incremental cache and the tag cache
18
+ */
19
+ export function getComposableCacheStorageKey(cacheKey) {
20
+ return createHash("sha256")
21
+ .update(Buffer.from(cacheKey, "utf16le"))
22
+ .digest("hex");
23
+ }
4
24
  /**
5
25
  *
6
26
  * @param key The key for that specific cache entry
@@ -45,7 +65,7 @@ export function getStaleLastModified(revalidate) {
45
65
  return 1;
46
66
  }
47
67
  if (typeof revalidate !== "number") {
48
- // Without a revalidate value Next cannot derive an expire time either,
68
+ // The cache adapter then reports `{ revalidate: 1 }` without `expire` (see `getCacheControl`),
49
69
  // so the historical sentinel is still safe here.
50
70
  return 1;
51
71
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "access": "public"
4
4
  },
5
5
  "name": "@opennextjs/aws",
6
- "version": "4.1.13",
6
+ "version": "4.1.15",
7
7
  "bin": {
8
8
  "open-next": "./dist/index.js"
9
9
  },
@@ -57,13 +57,13 @@
57
57
  "@types/node": "20.17.6",
58
58
  "concurrently": "^9.2.4",
59
59
  "diff": "^9.0.0",
60
- "next": "16.4.1",
60
+ "next": "16.4.5",
61
61
  "tsc-alias": "^1.9.7",
62
62
  "typescript": "5.9.3"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "diff": "^9.0.0",
66
- "next": ">=15.5.28 <16 || >=16.4.1"
66
+ "next": ">=15.5.29 <16 || >=16.4.5"
67
67
  },
68
68
  "peerDependenciesMeta": {
69
69
  "diff": {