@decocms/start 0.37.0 → 0.37.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/start",
3
- "version": "0.37.0",
3
+ "version": "0.37.2",
4
4
  "type": "module",
5
5
  "description": "Deco framework for TanStack Start - CMS bridge, admin protocol, hooks, schema generation",
6
6
  "main": "./src/index.ts",
@@ -8,6 +8,7 @@
8
8
  * This runs AFTER resolveDecoPage and BEFORE React rendering,
9
9
  * inside the TanStack Start server function.
10
10
  */
11
+ import { getCacheProfile } from "../sdk/cacheHeaders";
11
12
  import { djb2 } from "../sdk/djb2";
12
13
  import type { ResolvedSection } from "./resolve";
13
14
 
@@ -37,7 +38,6 @@ type CacheableSectionInput = CacheableSectionConfig | import("../sdk/cacheHeader
37
38
 
38
39
  function resolveSectionCacheConfig(input: CacheableSectionInput): CacheableSectionConfig {
39
40
  if (typeof input === "string") {
40
- const { getCacheProfile } = require("../sdk/cacheHeaders") as typeof import("../sdk/cacheHeaders");
41
41
  const profile = getCacheProfile(input);
42
42
  return { maxAge: profile.loader.fresh };
43
43
  }
@@ -11,7 +11,7 @@
11
11
  * (e.g. "product") which derives timing from the unified profile system.
12
12
  */
13
13
 
14
- import type { CacheProfileName } from "./cacheHeaders";
14
+ import { loaderCacheOptions, type CacheProfileName } from "./cacheHeaders";
15
15
 
16
16
  export type CachePolicy = "no-store" | "no-cache" | "stale-while-revalidate";
17
17
 
@@ -55,9 +55,6 @@ function resolveOptions(
55
55
  optionsOrProfile: CachedLoaderOptions | CacheProfileName,
56
56
  ): CachedLoaderOptions {
57
57
  if (typeof optionsOrProfile === "string") {
58
- // Lazy import to avoid circular dependency at module load time.
59
- // loaderCacheOptions() reads from the PROFILES map in cacheHeaders.ts.
60
- const { loaderCacheOptions } = require("./cacheHeaders") as typeof import("./cacheHeaders");
61
58
  return loaderCacheOptions(optionsOrProfile);
62
59
  }
63
60
  return optionsOrProfile;
@@ -873,10 +873,12 @@ export function createDecoWorkerEntry(
873
873
  return resp;
874
874
  }
875
875
 
876
- // Store in Cache API and return
877
- const toReturn = dressResponse(origin, "MISS");
876
+ // Clone for cache BEFORE dressResponse consumes the body stream.
877
+ // dressResponse() calls new Response(resp.body, resp) which locks
878
+ // the ReadableStream. Calling clone() on a locked body corrupts
879
+ // the stream in Workers runtime, causing Error 1101.
878
880
  storeInCache(origin);
879
- return toReturn;
881
+ return dressResponse(origin, "MISS");
880
882
  },
881
883
  };
882
884
  }