@bleedingdev/modern-js-app-tools 3.9.0-ultramodern.10 → 3.9.0-ultramodern.11

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.
@@ -37,7 +37,7 @@ export interface CacheControl {
37
37
  }
38
38
  ```
39
39
 
40
- Here, `customKey` is the custom cache key. By default, Modern.js uses the request `pathname` as the cache key, but developers can define it when necessary.
40
+ Here, `customKey` is the custom cache key. By default, the cache key is derived from the request's origin, normalized pathname (trailing slash removed), and query string. When `customKey` is set, it fully replaces the default key: the `customKey` callback receives the normalized pathname (not the `CacheOptionProvider`'s `req`) and is responsible for the whole partition (e.g. by tenant, host, or query) — it must not embed raw cookies or other credentials into the returned key.
41
41
 
42
42
  **Function Type**
43
43
 
@@ -108,6 +108,19 @@ export const cacheOption: CacheOption = {
108
108
 
109
109
  The above `/home` and `/about` are patterns, meaning `/home/abc` will also match. You can use regex in these patterns, such as `/home/.+`.
110
110
 
111
+ ### Cache Policy
112
+
113
+ The following policy is enforced automatically and cannot be overridden by the returned `CacheControl`:
114
+
115
+ - Only `GET` requests are cached.
116
+ - A request carrying a `Cookie` or `Authorization` header skips the cache unless `customKey` is set, since a custom key is treated as an explicit partitioning contract.
117
+ - A request with `Cache-Control: private`, `no-cache`, or `no-store` skips the cache.
118
+ - A response is only stored when it is `200`, has no `private`/`no-cache`/`no-store` in `Cache-Control`, has no `Set-Cookie`, and has no nonempty `Vary` header; otherwise any existing cache entry for that key is deleted instead of being written.
119
+ - If a `stale` revalidation produces a response that is no longer cacheable (for example, it became per-user), that already-served stale response is unaffected, but the cache entry is evicted so subsequent requests no longer hit it.
120
+ - A `CacheOptionProvider` returning `false` still disables caching entirely for that request, independent of the policy above.
121
+
122
+ Cache keys are namespaced (`__ssr__cache:v2:...`). Older un-namespaced entries — including ones already stored in a custom `Container` — are never read back; they simply age out under the container's own eviction/TTL. There is no global cache flush.
123
+
111
124
  ### Cache Container
112
125
 
113
126
  By default, the server uses memory for caching. Typically, services are deployed in a Serverless container, creating a new process for each access, making it impossible to use the previous cache.
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.9.0-ultramodern.10",
20
+ "version": "3.9.0-ultramodern.11",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "main": "./dist/cjs/index.js",
23
23
  "exports": {
@@ -127,18 +127,18 @@
127
127
  "@babel/traverse": "^8.0.4",
128
128
  "@babel/types": "^8.0.4",
129
129
  "@loadable/component": "5.16.7",
130
- "@modern-js/app-tools-extensions": "npm:@bleedingdev/modern-js-app-tools-extensions@3.9.0-ultramodern.10",
131
- "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.0-ultramodern.10",
132
- "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.9.0-ultramodern.10",
133
- "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.10",
134
- "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.10",
135
- "@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.9.0-ultramodern.10",
136
- "@modern-js/server": "npm:@bleedingdev/modern-js-server@3.9.0-ultramodern.10",
137
- "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.10",
138
- "@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.10",
139
- "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.9.0-ultramodern.10",
140
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.10",
141
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.10",
130
+ "@modern-js/app-tools-extensions": "npm:@bleedingdev/modern-js-app-tools-extensions@3.9.0-ultramodern.11",
131
+ "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.0-ultramodern.11",
132
+ "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.9.0-ultramodern.11",
133
+ "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.11",
134
+ "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.11",
135
+ "@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.9.0-ultramodern.11",
136
+ "@modern-js/server": "npm:@bleedingdev/modern-js-server@3.9.0-ultramodern.11",
137
+ "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.11",
138
+ "@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.11",
139
+ "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.9.0-ultramodern.11",
140
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.11",
141
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.11",
142
142
  "@rsbuild/core": "2.2.3",
143
143
  "@swc/core": "1.16.2",
144
144
  "@swc/helpers": "^0.5.23",