@yysng/astro-boilerplate 1.1.8 → 1.1.10

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.8",
3
+ "version": "1.1.10",
4
4
  "description": "Astro + Sanity Boilerplate with AEO Layers 1–5",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,13 +1,17 @@
1
- import fs from "fs/promises";
2
- import path from "path";
3
- import { CONTENT_REGISTRY } from "./registry.js";
4
- import { getContentRoot } from "./config.js";
5
-
6
- export async function loadContent(key) {
7
- const entry = CONTENT_REGISTRY[key];
8
- if (!entry) throw new Error(`Unknown content key: ${key}`);
9
-
10
- const filePath = path.join(getContentRoot(), entry.file);
11
- const raw = await fs.readFile(filePath, "utf-8");
12
- return JSON.parse(raw);
13
- }
1
+ // src/content-system/loader.js
2
+
3
+ const contentModules = import.meta.glob(
4
+ '/src/content/*.json',
5
+ { eager: true }
6
+ );
7
+
8
+ export function loadContent(key) {
9
+ const path = `/src/content/${key}.json`;
10
+ const mod = contentModules[path];
11
+
12
+ if (!mod || !mod.default) {
13
+ throw new Error(`Content not found: ${path}`);
14
+ }
15
+
16
+ return mod.default;
17
+ }