lambder 11.0.1 → 11.1.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.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,23 @@ sit on its first published patch, and later patches list only what they changed.
9
9
  Releases up to 3.2.6 carry git tags; the ones after it were published without
10
10
  one, so versions are not cross-linked to tag comparisons here.
11
11
 
12
+ ## [11.1.1] - 2026-09-30
13
+
14
+ A minor for an app whose shell files sit behind a shared cache: a file whose
15
+ name does not change when its bytes do is revalidated rather than kept.
16
+
17
+ ### Changed
18
+
19
+ - **`servePublicFiles` answers a file its immutable rule does not match with
20
+ `Cache-Control: no-cache`**, where it answered `public, max-age=3600`. A
21
+ service worker, a web manifest or a favicon keeps its name across a deploy,
22
+ so a CDN or proxy honouring the hour served the old copy to everyone for up
23
+ to an hour afterwards, and an app behind one had to purge it on every
24
+ deploy. Every GET or HEAD 200 already carries an ETag, so a revalidation of
25
+ an unchanged file is a 304 with no body. Content-hashed build output keeps
26
+ `immutableCacheControl`, and an app that wants the old behaviour passes
27
+ `cacheControl: "public, max-age=3600"`.
28
+
12
29
  ## [11.0.1] - 2026-09-29
13
30
 
14
31
  A major for an app with many APIs: what one API costs the type checker no
@@ -13,7 +13,14 @@ export type LambderPublicFilesOptions = {
13
13
  * mapper. Return null/undefined to skip. Default: the file path as it is.
14
14
  */
15
15
  path?: (ctx: LambderRenderContext, filePath: string) => string | null | undefined;
16
- /** Cache-Control for served files; the function receives the relative file path. Default: "public, max-age=3600". */
16
+ /**
17
+ * Cache-Control for served files that do not match immutablePattern; the
18
+ * function receives the relative file path. Default: "no-cache". Such a
19
+ * file keeps its name when its bytes change (a service worker, a web
20
+ * manifest, a favicon), so a shared cache holding it for a while serves
21
+ * the old copy after a deploy; revalidating instead costs a 304, since
22
+ * every GET or HEAD 200 carries an ETag.
23
+ */
17
24
  cacheControl?: string | ((ctx: LambderRenderContext, relativePath: string) => string);
18
25
  /** Relative paths matching this get immutableCacheControl. Default: content-hashed names in a bundler's output folder (assets/, static/, _next/static/). Set false to disable. */
19
26
  immutablePattern?: RegExp | false;
@@ -29,7 +29,7 @@ const EXACT_BUNDLER_HASH = "-(?=[\\w-]{0,7}[a-z])(?:(?=[\\w-]{0,7}[A-Z])(?=[\\w-
29
29
  const LONG_BUNDLER_HASH = "[-.](?=\\w*[A-Za-z])(?=\\w*\\d)\\w{8,}";
30
30
  const DEFAULT_IMMUTABLE_PATTERN = new RegExp(`(?:^|/)_next/static/|(?:^|/)(?:assets|static)/(?:[^/]+/)*[^/]*(?:${EXACT_BUNDLER_HASH}|${LONG_BUNDLER_HASH})(?:\\.chunk)?\\.[A-Za-z0-9]+$`);
31
31
  const DEFAULT_IMMUTABLE_CACHE_CONTROL = "public, max-age=31536000, immutable";
32
- const DEFAULT_CACHE_CONTROL = "public, max-age=3600";
32
+ const DEFAULT_CACHE_CONTROL = "no-cache";
33
33
  /**
34
34
  * Terminal public-file handler registered via lambder.servePublicFiles().
35
35
  * Runs only when no route matched, so it can never shadow routes registered
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambder",
3
- "version": "11.0.1",
3
+ "version": "11.1.1",
4
4
  "sideEffects": false,
5
5
  "description": "Opinionated serverless web framework for TypeScript on AWS Lambda: type-safe APIs from Zod schemas, DynamoDB sessions, and declarative rate limits, authorization guards and idempotency.",
6
6
  "keywords": [