@yysng/astro-boilerplate 1.1.18 โ†’ 1.1.19

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": "@yysng/astro-boilerplate",
3
- "version": "1.1.18",
3
+ "version": "1.1.19",
4
4
  "description": "Astro + Sanity Boilerplate with AEO Layers 1โ€“5",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,15 +1,24 @@
1
1
  import { CONTENT_REGISTRY } from "./registry.js";
2
2
  import { readLocal } from "./storage.js";
3
+ import { getContentRoot } from "./config.js";
3
4
 
4
5
  export async function loadContent(key, env = {}) {
5
6
  const entry = CONTENT_REGISTRY[key];
6
7
  if (!entry) throw new Error(`Unknown content key: ${key}`);
7
8
 
9
+ // ๐ŸŒ Production: Cloudflare KV only
8
10
  if (env?.CONTENT_KV) {
9
11
  const stored = await env.CONTENT_KV.get(entry.file, "json");
10
12
  if (stored) return stored;
13
+
11
14
  throw new Error(`KV missing content for key "${key}" (file "${entry.file}")`);
12
15
  }
13
16
 
14
- return await readLocal(entry.file);
17
+ // ๐Ÿงช Local Node only
18
+ const root = getContentRoot();
19
+ if (!root) {
20
+ throw new Error("Content root not configured in local environment");
21
+ }
22
+
23
+ return await readLocal(root, entry.file);
15
24
  }