@yysng/astro-boilerplate 1.1.32 → 1.1.34
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.
|
|
3
|
+
"version": "1.1.34",
|
|
4
4
|
"description": "Astro + Sanity Boilerplate with AEO Layers 1–5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"./layouts/*": "./src/layouts/*",
|
|
10
10
|
"./styles/*": "./src/styles/*",
|
|
11
11
|
"./lib/*": "./src/lib/*",
|
|
12
|
-
"./utils/*": "./src/utils/*"
|
|
12
|
+
"./utils/*": "./src/utils/*",
|
|
13
|
+
"./content-loader": "./src/content-system/loader.js",
|
|
14
|
+
"./content-storage": "./src/content-system/storage.js"
|
|
13
15
|
},
|
|
14
16
|
"main": "./src/index.js",
|
|
15
17
|
"files": [
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { CONTENT_REGISTRY } from "./registry.js";
|
|
2
|
-
import { readLocal } from "@yysng/astro-boilerplate/content-storage";
|
|
3
2
|
|
|
4
3
|
export async function loadContent(key, env = {}) {
|
|
5
4
|
const entry = CONTENT_REGISTRY[key];
|
|
6
5
|
if (!entry) throw new Error(`Unknown content key: ${key}`);
|
|
7
6
|
|
|
8
|
-
//
|
|
7
|
+
// Cloudflare runtime
|
|
9
8
|
if (env?.CONTENT_KV) {
|
|
10
9
|
const stored = await env.CONTENT_KV.get(entry.file, "json");
|
|
11
|
-
if (
|
|
12
|
-
|
|
10
|
+
if (stored) return stored;
|
|
11
|
+
throw new Error(`KV missing content for key "${key}"`);
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
//
|
|
16
|
-
|
|
14
|
+
// Local dev — dynamic import prevents fs from entering Worker bundle
|
|
15
|
+
const { readLocal } = await import("./storage.node.js");
|
|
16
|
+
return await readLocal(entry.file);
|
|
17
17
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { readLocal, writeLocal } from "./storage.node.js";
|