@yysng/astro-boilerplate 1.1.23 → 1.1.26
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 +1 -1
- package/src/content-system/loader.js +3 -11
package/package.json
CHANGED
|
@@ -5,19 +5,11 @@ export async function loadContent(key, env = {}) {
|
|
|
5
5
|
const entry = CONTENT_REGISTRY[key];
|
|
6
6
|
if (!entry) throw new Error(`Unknown content key: ${key}`);
|
|
7
7
|
|
|
8
|
-
// Cloudflare production: KV only
|
|
9
8
|
if (env?.CONTENT_KV) {
|
|
10
9
|
const stored = await env.CONTENT_KV.get(entry.file, "json");
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
return stored;
|
|
10
|
+
if (stored) return stored;
|
|
11
|
+
throw new Error(`KV missing content for ${entry.file}`);
|
|
15
12
|
}
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
if (typeof process !== "undefined" && process.versions?.node) {
|
|
19
|
-
return await readLocal(entry.file);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
throw new Error("Content system misconfigured: no KV and no local FS allowed");
|
|
14
|
+
return await readLocal(entry.file);
|
|
23
15
|
}
|