@pagesmith/core 0.2.0 → 0.4.0

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.
Files changed (83) hide show
  1. package/README.md +9 -4
  2. package/REFERENCE.md +284 -0
  3. package/dist/ai/index.d.mts +7 -4
  4. package/dist/ai/index.d.mts.map +1 -1
  5. package/dist/ai/index.mjs +605 -136
  6. package/dist/ai/index.mjs.map +1 -1
  7. package/dist/assets/index.d.mts +10 -1
  8. package/dist/assets/index.d.mts.map +1 -1
  9. package/dist/assets/index.mjs +2 -2
  10. package/dist/{assets-bX08zEJm.mjs → assets-CAPOqQ_P.mjs} +42 -5
  11. package/dist/assets-CAPOqQ_P.mjs.map +1 -0
  12. package/dist/{content-config-wW-3r5gG.d.mts → content-config-DJXUOcNG.d.mts} +47 -15
  13. package/dist/{content-config-wW-3r5gG.d.mts.map → content-config-DJXUOcNG.d.mts.map} +1 -1
  14. package/dist/{content-layer-DWdgdBeI.mjs → content-layer-B5enqWeJ.mjs} +195 -63
  15. package/dist/content-layer-B5enqWeJ.mjs.map +1 -0
  16. package/dist/content-layer-CpHYUYNN.d.mts +121 -0
  17. package/dist/content-layer-CpHYUYNN.d.mts.map +1 -0
  18. package/dist/create/index.d.mts.map +1 -1
  19. package/dist/create/index.mjs +26 -28
  20. package/dist/create/index.mjs.map +1 -1
  21. package/dist/css/index.d.mts +1 -1
  22. package/dist/css/index.mjs +1 -1
  23. package/dist/{css-ekIt2Fdb.mjs → css-BneO430t.mjs} +5 -4
  24. package/dist/css-BneO430t.mjs.map +1 -0
  25. package/dist/index-B7NRZAxd.d.mts +13 -0
  26. package/dist/index-B7NRZAxd.d.mts.map +1 -0
  27. package/dist/{index-D79hUFbK.d.mts → index-C0QFHYwb.d.mts} +1 -1
  28. package/dist/{index-D79hUFbK.d.mts.map → index-C0QFHYwb.d.mts.map} +1 -1
  29. package/dist/{index-DpRBzO8Q.d.mts → index-CJkBs8YQ.d.mts} +2 -2
  30. package/dist/index-CJkBs8YQ.d.mts.map +1 -0
  31. package/dist/{index-Dbsw1QON.d.mts → index-DCznbvaV.d.mts} +4 -2
  32. package/dist/{index-Dbsw1QON.d.mts.map → index-DCznbvaV.d.mts.map} +1 -1
  33. package/dist/index.d.mts +13 -91
  34. package/dist/index.d.mts.map +1 -1
  35. package/dist/index.mjs +16 -13
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/loaders/index.d.mts +2 -2
  38. package/dist/loaders/index.mjs +2 -2
  39. package/dist/{loaders-Bla48ZN9.mjs → loaders-Cf-BXf2L.mjs} +10 -2
  40. package/dist/{loaders-Bla48ZN9.mjs.map → loaders-Cf-BXf2L.mjs.map} +1 -1
  41. package/dist/markdown/index.d.mts +1 -1
  42. package/dist/markdown/index.mjs +1 -1
  43. package/dist/{markdown-Cj5X26FL.mjs → markdown-BmDJgYeB.mjs} +59 -9
  44. package/dist/markdown-BmDJgYeB.mjs.map +1 -0
  45. package/dist/mcp/index.d.mts +23 -0
  46. package/dist/mcp/index.d.mts.map +1 -0
  47. package/dist/mcp/index.mjs +2 -0
  48. package/dist/mcp/server.d.mts +13 -0
  49. package/dist/mcp/server.d.mts.map +1 -0
  50. package/dist/mcp/server.mjs +2 -0
  51. package/dist/runtime/index.mjs +1 -1
  52. package/dist/schemas/index.d.mts +2 -2
  53. package/dist/schemas/index.mjs +1 -1
  54. package/dist/{schemas-BZEPTGWs.mjs → schemas-UL4ynWsA.mjs} +1 -1
  55. package/dist/{schemas-BZEPTGWs.mjs.map → schemas-UL4ynWsA.mjs.map} +1 -1
  56. package/dist/server-D3DHoh5f.mjs +202 -0
  57. package/dist/server-D3DHoh5f.mjs.map +1 -0
  58. package/dist/ssg-utils/index.d.mts +61 -0
  59. package/dist/ssg-utils/index.d.mts.map +1 -0
  60. package/dist/ssg-utils/index.mjs +118 -0
  61. package/dist/ssg-utils/index.mjs.map +1 -0
  62. package/dist/vite/index.d.mts +68 -33
  63. package/dist/vite/index.d.mts.map +1 -1
  64. package/dist/vite/index.mjs +302 -227
  65. package/dist/vite/index.mjs.map +1 -1
  66. package/docs/agents/AGENTS.md.template +9 -0
  67. package/docs/agents/changelog-notes.md +15 -0
  68. package/docs/agents/errors.md +96 -0
  69. package/docs/agents/migration.md +25 -0
  70. package/docs/agents/recipes.md +26 -0
  71. package/docs/agents/usage.md +58 -0
  72. package/docs/llms-full.txt +53 -0
  73. package/docs/llms.txt +29 -0
  74. package/package.json +58 -6
  75. package/dist/assets-bX08zEJm.mjs.map +0 -1
  76. package/dist/content-layer-DWdgdBeI.mjs.map +0 -1
  77. package/dist/convert-XdGgNqH0.mjs +0 -27
  78. package/dist/convert-XdGgNqH0.mjs.map +0 -1
  79. package/dist/css-ekIt2Fdb.mjs.map +0 -1
  80. package/dist/index-CeNDTM-y.d.mts +0 -7
  81. package/dist/index-CeNDTM-y.d.mts.map +0 -1
  82. package/dist/index-DpRBzO8Q.d.mts.map +0 -1
  83. package/dist/markdown-Cj5X26FL.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/create/index.ts"],"mappings":";;AAwBA;;;;KAAY,QAAA;EACV,IAAA;EACA,WAAA;EACA,MAAA;EACA,IAAA;EACA,UAAA;EACA,OAAA,EAAS,MAAA;AAAA;AAAA,cAGE,SAAA,EAAW,QAAA;AAAA,iBA6ER,aAAA,CAAA;AAAA,iBAmKM,aAAA,CAAc,WAAA,UAAqB,YAAA,WAAuB,OAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/create/index.ts"],"mappings":";;AAiCA;;;;KAAY,QAAA;EACV,IAAA;EACA,WAAA;EACA,MAAA;EACA,IAAA;EACA,UAAA;EACA,OAAA,EAAS,MAAA;AAAA;AAAA,cAGE,SAAA,EAAW,QAAA;AAAA,iBAkFR,aAAA,CAAA;AAAA,iBA8IM,aAAA,CAAc,WAAA,UAAqB,YAAA,WAAuB,OAAA"}
@@ -1,5 +1,5 @@
1
- import { join, resolve } from "path";
2
1
  import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, unlinkSync, writeFileSync } from "fs";
2
+ import { join, resolve } from "path";
3
3
  import { tmpdir } from "os";
4
4
  import { execSync } from "child_process";
5
5
  //#region src/create/index.ts
@@ -9,7 +9,14 @@ import { execSync } from "child_process";
9
9
  * Supports local templates (bundled) and remote templates (GitHub examples).
10
10
  */
11
11
  const GITHUB_REPO = "sujeet-pro/pagesmith";
12
- const PACKAGE_VERSION = "^0.1.0";
12
+ function getPackageVersion() {
13
+ try {
14
+ const pkgPath = resolve(import.meta.dirname, "..", "..", "package.json");
15
+ return `^${JSON.parse(readFileSync(pkgPath, "utf-8")).version ?? "0.1.0"}`;
16
+ } catch {
17
+ return "^0.1.0";
18
+ }
19
+ }
13
20
  const templates = [
14
21
  {
15
22
  name: "docs",
@@ -30,8 +37,9 @@ const templates = [
30
37
  path: "examples/blog-site",
31
38
  dependency: "@pagesmith/core",
32
39
  scripts: {
33
- dev: "node --watch build.mjs",
34
- build: "node build.mjs"
40
+ dev: "vp dev",
41
+ build: "vp build",
42
+ check: "vp check"
35
43
  }
36
44
  },
37
45
  {
@@ -42,7 +50,8 @@ const templates = [
42
50
  dependency: "@pagesmith/core",
43
51
  scripts: {
44
52
  dev: "vp dev",
45
- build: "node build.mjs",
53
+ build: "vp build",
54
+ check: "vp check",
46
55
  preview: "vp preview"
47
56
  }
48
57
  },
@@ -54,7 +63,8 @@ const templates = [
54
63
  dependency: "@pagesmith/core",
55
64
  scripts: {
56
65
  dev: "vp dev",
57
- build: "node build.mjs",
66
+ build: "vp build",
67
+ check: "vp check",
58
68
  preview: "vp preview"
59
69
  }
60
70
  },
@@ -66,7 +76,8 @@ const templates = [
66
76
  dependency: "@pagesmith/core",
67
77
  scripts: {
68
78
  dev: "vp dev",
69
- build: "node build.mjs",
79
+ build: "vp build",
80
+ check: "vp check",
70
81
  preview: "vp preview"
71
82
  }
72
83
  },
@@ -77,8 +88,9 @@ const templates = [
77
88
  path: "examples/with-vanilla-ejs",
78
89
  dependency: "@pagesmith/core",
79
90
  scripts: {
80
- dev: "node --watch build.mjs",
81
- build: "node build.mjs"
91
+ dev: "vp dev",
92
+ build: "vp build",
93
+ check: "vp check"
82
94
  }
83
95
  },
84
96
  {
@@ -88,8 +100,9 @@ const templates = [
88
100
  path: "examples/with-vanilla-hbs",
89
101
  dependency: "@pagesmith/core",
90
102
  scripts: {
91
- dev: "node --watch build.mjs",
92
- build: "node build.mjs"
103
+ dev: "vp dev",
104
+ build: "vp build",
105
+ check: "vp check"
93
106
  }
94
107
  }
95
108
  ];
@@ -113,21 +126,6 @@ async function downloadFromGithub(templatePath, destination) {
113
126
  if (!existsSync(sourcePath)) throw new Error(`Template path not found in repo: ${templatePath}`);
114
127
  mkdirSync(destination, { recursive: true });
115
128
  cpSync(sourcePath, destination, { recursive: true });
116
- const sharedContentPath = join(tmpExtract, topDir, "examples/shared-content");
117
- if (existsSync(sharedContentPath) && templatePath.startsWith("examples/with-")) {
118
- const contentDest = join(destination, "content");
119
- mkdirSync(contentDest, { recursive: true });
120
- for (const subDir of [
121
- "posts",
122
- "pages",
123
- "authors"
124
- ]) {
125
- const srcDir = join(sharedContentPath, subDir);
126
- if (existsSync(srcDir)) cpSync(srcDir, join(contentDest, subDir), { recursive: true });
127
- }
128
- const configSrc = join(sharedContentPath, "content.config.mjs");
129
- if (existsSync(configSrc)) cpSync(configSrc, join(destination, "content.config.mjs"));
130
- }
131
129
  } finally {
132
130
  unlinkSync(tmpFile);
133
131
  rmSync(tmpExtract, {
@@ -179,10 +177,10 @@ function writePackageJson(destination, projectName, template) {
179
177
  pkg.version = "0.0.0";
180
178
  pkg.scripts = template.scripts;
181
179
  if (pkg.dependencies) {
182
- for (const [name, version] of Object.entries(pkg.dependencies)) if (version === "*" && name.startsWith("@pagesmith/")) pkg.dependencies[name] = PACKAGE_VERSION;
180
+ for (const [name, version] of Object.entries(pkg.dependencies)) if (version === "*" && name.startsWith("@pagesmith/")) pkg.dependencies[name] = getPackageVersion();
183
181
  }
184
182
  pkg.dependencies = pkg.dependencies ?? {};
185
- pkg.dependencies[template.dependency] = PACKAGE_VERSION;
183
+ pkg.dependencies[template.dependency] = getPackageVersion();
186
184
  if (pkg.devDependencies?.vite && !pkg.devDependencies["vite-plus"]) pkg.devDependencies["vite-plus"] = "^0.1.13";
187
185
  pkg.packageManager = "npm@11.12.0";
188
186
  writeFileSync(existingPkg, JSON.stringify(pkg, null, 2) + "\n");
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/create/index.ts"],"sourcesContent":["/**\n * Project scaffolding for `pagesmith create`.\n *\n * Supports local templates (bundled) and remote templates (GitHub examples).\n */\n\nimport {\n cpSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\n readdirSync,\n readFileSync,\n rmSync,\n unlinkSync,\n writeFileSync,\n} from 'fs'\nimport { join, resolve } from 'path'\nimport { execSync } from 'child_process'\nimport { tmpdir } from 'os'\n\nconst GITHUB_REPO = 'sujeet-pro/pagesmith'\nconst PACKAGE_VERSION = '^0.1.0'\n\nexport type Template = {\n name: string\n description: string\n source: 'local' | 'github'\n path: string\n dependency: '@pagesmith/core' | '@pagesmith/docs'\n scripts: Record<string, string>\n}\n\nexport const templates: Template[] = [\n {\n name: 'docs',\n description: 'Documentation site with @pagesmith/docs',\n source: 'local',\n path: 'templates/docs',\n dependency: '@pagesmith/docs',\n scripts: { dev: 'pagesmith dev', build: 'pagesmith build', preview: 'pagesmith preview' },\n },\n {\n name: 'blog',\n description: 'Blog with custom layouts using @pagesmith/core',\n source: 'github',\n path: 'examples/blog-site',\n dependency: '@pagesmith/core',\n scripts: { dev: 'node --watch build.mjs', build: 'node build.mjs' },\n },\n {\n name: 'react',\n description: 'React SSG site with react-router',\n source: 'github',\n path: 'examples/with-react',\n dependency: '@pagesmith/core',\n scripts: {\n dev: 'vp dev',\n build: 'node build.mjs',\n preview: 'vp preview',\n },\n },\n {\n name: 'solid',\n description: 'SolidJS SSG site',\n source: 'github',\n path: 'examples/with-solid',\n dependency: '@pagesmith/core',\n scripts: {\n dev: 'vp dev',\n build: 'node build.mjs',\n preview: 'vp preview',\n },\n },\n {\n name: 'svelte',\n description: 'Svelte SSG site',\n source: 'github',\n path: 'examples/with-svelte',\n dependency: '@pagesmith/core',\n scripts: {\n dev: 'vp dev',\n build: 'node build.mjs',\n preview: 'vp preview',\n },\n },\n {\n name: 'ejs',\n description: 'Vanilla Node.js + EJS templates',\n source: 'github',\n path: 'examples/with-vanilla-ejs',\n dependency: '@pagesmith/core',\n scripts: {\n dev: 'node --watch build.mjs',\n build: 'node build.mjs',\n },\n },\n {\n name: 'hbs',\n description: 'Vanilla Node.js + Handlebars templates',\n source: 'github',\n path: 'examples/with-vanilla-hbs',\n dependency: '@pagesmith/core',\n scripts: {\n dev: 'node --watch build.mjs',\n build: 'node build.mjs',\n },\n },\n]\n\nexport function listTemplates(): string {\n const maxName = Math.max(...templates.map((t) => t.name.length))\n return templates.map((t) => ` ${t.name.padEnd(maxName + 2)} ${t.description}`).join('\\n')\n}\n\nasync function downloadFromGithub(templatePath: string, destination: string): Promise<void> {\n const tarballUrl = `https://github.com/${GITHUB_REPO}/archive/refs/heads/main.tar.gz`\n console.log('Downloading template from GitHub...')\n\n const response = await fetch(tarballUrl, { redirect: 'follow' })\n if (!response.ok) {\n throw new Error(`Failed to download: ${response.status} ${response.statusText}`)\n }\n\n const tmpFile = join(tmpdir(), `pagesmith-${Date.now()}.tar.gz`)\n const tmpExtract = mkdtempSync(join(tmpdir(), 'pagesmith-'))\n\n try {\n writeFileSync(tmpFile, Buffer.from(await response.arrayBuffer()))\n\n // Extract full tarball\n execSync(`tar xzf ${tmpFile} -C ${tmpExtract}`, { stdio: 'pipe' })\n\n // Find the extracted top-level directory\n const dirs = readdirSync(tmpExtract)\n const topDir = dirs[0]\n if (!topDir) throw new Error('Empty tarball')\n\n const sourcePath = join(tmpExtract, topDir, templatePath)\n if (!existsSync(sourcePath)) {\n throw new Error(`Template path not found in repo: ${templatePath}`)\n }\n\n mkdirSync(destination, { recursive: true })\n cpSync(sourcePath, destination, { recursive: true })\n\n // Also copy shared-content for framework examples\n const sharedContentPath = join(tmpExtract, topDir, 'examples/shared-content')\n if (existsSync(sharedContentPath) && templatePath.startsWith('examples/with-')) {\n const contentDest = join(destination, 'content')\n mkdirSync(contentDest, { recursive: true })\n\n // Copy markdown/data files from shared-content\n for (const subDir of ['posts', 'pages', 'authors']) {\n const srcDir = join(sharedContentPath, subDir)\n if (existsSync(srcDir)) {\n cpSync(srcDir, join(contentDest, subDir), { recursive: true })\n }\n }\n\n // Copy content config\n const configSrc = join(sharedContentPath, 'content.config.mjs')\n if (existsSync(configSrc)) {\n cpSync(configSrc, join(destination, 'content.config.mjs'))\n }\n }\n } finally {\n unlinkSync(tmpFile)\n rmSync(tmpExtract, { recursive: true, force: true })\n }\n}\n\nfunction adaptForStandalone(destination: string, template: Template): void {\n // Update content.config.mjs paths (from ./posts to ./content/posts)\n const configPath = join(destination, 'content.config.mjs')\n if (existsSync(configPath)) {\n let config = readFileSync(configPath, 'utf-8')\n config = config.replace(/directory: '\\.\\/posts'/g, \"directory: './content/posts'\")\n config = config.replace(/directory: '\\.\\/pages'/g, \"directory: './content/pages'\")\n config = config.replace(/directory: '\\.\\/authors'/g, \"directory: './content/authors'\")\n config = config.replace(/directory: '\\.\\/config'/g, \"directory: './content/config'\")\n writeFileSync(configPath, config)\n }\n\n // Update vite.config.ts shared-content references\n const viteConfigPath = join(destination, 'vite.config.ts')\n if (existsSync(viteConfigPath)) {\n let config = readFileSync(viteConfigPath, 'utf-8')\n config = config.replace(\n /import content from '\\.\\.\\/shared-content\\/content\\.config'/g,\n \"import content from './content.config.mjs'\",\n )\n config = config.replace(\n /configPath:\\s*'\\.\\.\\/shared-content\\/content\\.config\\.ts'/g,\n \"configPath: './content.config.mjs'\",\n )\n config = config.replace(\n /root:\\s*resolve\\(import\\.meta\\.dirname,\\s*'\\.\\.\\/shared-content'\\)/g,\n 'root: import.meta.dirname',\n )\n writeFileSync(viteConfigPath, config)\n }\n\n // Update build.mjs (remove shared-content references)\n const buildPath = join(destination, 'build.mjs')\n if (existsSync(buildPath)) {\n let script = readFileSync(buildPath, 'utf-8')\n // Replace shared-content imports\n script = script.replace(\n /import .* from '\\.\\.\\/shared-content\\/content\\.config\\.mjs'/g,\n \"import content from './content.config.mjs'\",\n )\n // Simplify content layer setup\n script = script.replace(\n /const contentRoot = resolve\\(root, '\\.\\.\\/shared-content'\\)/g,\n 'const contentRoot = root',\n )\n // Fix named imports\n script = script.replace(\n /import \\{ pages, posts \\} from '\\.\\.\\/shared-content\\/content\\.config\\.mjs'/g,\n \"import content from './content.config.mjs'\\nconst { pages, posts } = content\",\n )\n writeFileSync(buildPath, script)\n }\n\n // Remove workspace-specific tsconfig paths\n const tsconfigPath = join(destination, 'tsconfig.json')\n if (existsSync(tsconfigPath)) {\n const tsconfig = JSON.parse(readFileSync(tsconfigPath, 'utf-8'))\n if (tsconfig.compilerOptions?.paths) {\n delete tsconfig.compilerOptions.paths\n }\n writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2) + '\\n')\n }\n}\n\nfunction writePackageJson(destination: string, projectName: string, template: Template): void {\n const existingPkg = join(destination, 'package.json')\n let pkg: Record<string, any> = {}\n\n if (existsSync(existingPkg)) {\n pkg = JSON.parse(readFileSync(existingPkg, 'utf-8'))\n }\n\n pkg.name = projectName\n pkg.private = true\n pkg.type = 'module'\n pkg.version = '0.0.0'\n pkg.scripts = template.scripts\n\n // Replace workspace \"*\" deps with actual versions\n if (pkg.dependencies) {\n for (const [name, version] of Object.entries(pkg.dependencies)) {\n if (version === '*' && name.startsWith('@pagesmith/')) {\n pkg.dependencies[name] = PACKAGE_VERSION\n }\n }\n }\n\n // Ensure the primary dependency is present\n pkg.dependencies = pkg.dependencies ?? {}\n pkg.dependencies[template.dependency] = PACKAGE_VERSION\n\n // Keep Vite+ in standalone examples that already use it\n if (pkg.devDependencies?.vite && !pkg.devDependencies['vite-plus']) {\n pkg.devDependencies['vite-plus'] = '^0.1.13'\n }\n\n pkg.packageManager = 'npm@11.12.0'\n\n writeFileSync(existingPkg, JSON.stringify(pkg, null, 2) + '\\n')\n}\n\nexport async function createProject(projectName: string, templateName: string): Promise<void> {\n const template = templates.find((t) => t.name === templateName)\n if (!template) {\n throw new Error(`Unknown template \"${templateName}\". Available templates:\\n${listTemplates()}`)\n }\n\n const destination = resolve(projectName)\n if (existsSync(destination) && readdirSync(destination).length > 0) {\n throw new Error(`Directory \"${projectName}\" already exists and is not empty.`)\n }\n\n if (template.source === 'local') {\n const templateDir = resolve(\n import.meta.dirname,\n '../../templates',\n template.path.split('/').pop()!,\n )\n mkdirSync(destination, { recursive: true })\n cpSync(templateDir, destination, { recursive: true })\n } else {\n await downloadFromGithub(template.path, destination)\n adaptForStandalone(destination, template)\n }\n\n writePackageJson(destination, projectName, template)\n\n console.log(`\\nCreated \"${projectName}\" from the \"${template.name}\" template.\\n`)\n console.log('Next steps:')\n console.log(` cd ${projectName}`)\n console.log(' vp install')\n if (template.scripts.dev) {\n console.log(` vp run dev`)\n } else {\n console.log(` vp run build`)\n }\n console.log()\n}\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,cAAc;AACpB,MAAM,kBAAkB;AAWxB,MAAa,YAAwB;CACnC;EACE,MAAM;EACN,aAAa;EACb,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,SAAS;GAAE,KAAK;GAAiB,OAAO;GAAmB,SAAS;GAAqB;EAC1F;CACD;EACE,MAAM;EACN,aAAa;EACb,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,SAAS;GAAE,KAAK;GAA0B,OAAO;GAAkB;EACpE;CACD;EACE,MAAM;EACN,aAAa;EACb,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,SAAS;GACP,KAAK;GACL,OAAO;GACP,SAAS;GACV;EACF;CACD;EACE,MAAM;EACN,aAAa;EACb,QAAQ;EACR,MAAM;EACN,YAAY;EACZ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AAqC;CAC5F,MAAM,WAAW,UAAU,MAAM,MAAM,EAAE,SAAS,aAAa;AAC/D,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,qBAAqB,aAAa,2BAA2B,eAAe,GAAG;CAGjG,MAAM,cAAc,QAAQ,YAAY;AACxC,KAAI,WAAW,YAAY,IAAI,YAAY,YAAY,CAAC,SAAS,EAC/D,OAAM,IAAI,MAAM,cAAc,YAAY,oCAAoC;AAGhF,KAAI,SAAS,WAAW,SAAS;EAC/B,MAAM,cAAc,QAClB,OAAO,KAAK,SACZ,mBACA,SAAS,KAAK,MAAM,IAAI,CAAC,KAAK,CAC/B;AACD,YAAU,aAAa,EAAE,WAAW,MAAM,CAAC;AAC3C,SAAO,aAAa,aAAa,EAAE,WAAW,MAAM,CAAC;QAChD;AACL,QAAM,mBAAmB,SAAS,MAAM,YAAY;AACpD,qBAAmB,aAAa,SAAS;;AAG3C,kBAAiB,aAAa,aAAa,SAAS;AAEpD,SAAQ,IAAI,cAAc,YAAY,cAAc,SAAS,KAAK,eAAe;AACjF,SAAQ,IAAI,cAAc;AAC1B,SAAQ,IAAI,QAAQ,cAAc;AAClC,SAAQ,IAAI,eAAe;AAC3B,KAAI,SAAS,QAAQ,IACnB,SAAQ,IAAI,eAAe;KAE3B,SAAQ,IAAI,iBAAiB;AAE/B,SAAQ,KAAK"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/create/index.ts"],"sourcesContent":["/**\n * Project scaffolding for `pagesmith create`.\n *\n * Supports local templates (bundled) and remote templates (GitHub examples).\n */\n\nimport {\n cpSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\n readdirSync,\n readFileSync,\n rmSync,\n unlinkSync,\n writeFileSync,\n} from 'fs'\nimport { join, resolve } from 'path'\nimport { execSync } from 'child_process'\nimport { tmpdir } from 'os'\n\nconst GITHUB_REPO = 'sujeet-pro/pagesmith'\n\nfunction getPackageVersion(): string {\n try {\n const pkgPath = resolve(import.meta.dirname, '..', '..', 'package.json')\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8')) as { version?: string }\n return `^${pkg.version ?? '0.1.0'}`\n } catch {\n return '^0.1.0'\n }\n}\n\nexport type Template = {\n name: string\n description: string\n source: 'local' | 'github'\n path: string\n dependency: '@pagesmith/core' | '@pagesmith/docs'\n scripts: Record<string, string>\n}\n\nexport const templates: Template[] = [\n {\n name: 'docs',\n description: 'Documentation site with @pagesmith/docs',\n source: 'local',\n path: 'templates/docs',\n dependency: '@pagesmith/docs',\n scripts: { dev: 'pagesmith dev', build: 'pagesmith build', preview: 'pagesmith preview' },\n },\n {\n name: 'blog',\n description: 'Blog with custom layouts using @pagesmith/core',\n source: 'github',\n path: 'examples/blog-site',\n dependency: '@pagesmith/core',\n scripts: { dev: 'vp dev', build: 'vp build', check: 'vp check' },\n },\n {\n name: 'react',\n description: 'React SSG site with react-router',\n source: 'github',\n path: 'examples/with-react',\n dependency: '@pagesmith/core',\n scripts: {\n dev: 'vp dev',\n build: 'vp build',\n check: 'vp check',\n preview: 'vp preview',\n },\n },\n {\n name: 'solid',\n description: 'SolidJS SSG site',\n source: 'github',\n path: 'examples/with-solid',\n dependency: '@pagesmith/core',\n scripts: {\n dev: 'vp dev',\n build: 'vp build',\n check: 'vp check',\n preview: 'vp preview',\n },\n },\n {\n name: 'svelte',\n description: 'Svelte SSG site',\n source: 'github',\n path: 'examples/with-svelte',\n dependency: '@pagesmith/core',\n scripts: {\n dev: 'vp dev',\n build: 'vp build',\n check: 'vp check',\n preview: 'vp preview',\n },\n },\n {\n name: 'ejs',\n description: 'Vanilla Node.js + EJS templates',\n source: 'github',\n path: 'examples/with-vanilla-ejs',\n dependency: '@pagesmith/core',\n scripts: {\n dev: 'vp dev',\n build: 'vp build',\n check: 'vp check',\n },\n },\n {\n name: 'hbs',\n description: 'Vanilla Node.js + Handlebars templates',\n source: 'github',\n path: 'examples/with-vanilla-hbs',\n dependency: '@pagesmith/core',\n scripts: {\n dev: 'vp dev',\n build: 'vp build',\n check: 'vp check',\n },\n },\n]\n\nexport function listTemplates(): string {\n const maxName = Math.max(...templates.map((t) => t.name.length))\n return templates.map((t) => ` ${t.name.padEnd(maxName + 2)} ${t.description}`).join('\\n')\n}\n\nasync function downloadFromGithub(templatePath: string, destination: string): Promise<void> {\n const tarballUrl = `https://github.com/${GITHUB_REPO}/archive/refs/heads/main.tar.gz`\n console.log('Downloading template from GitHub...')\n\n const response = await fetch(tarballUrl, { redirect: 'follow' })\n if (!response.ok) {\n throw new Error(`Failed to download: ${response.status} ${response.statusText}`)\n }\n\n const tmpFile = join(tmpdir(), `pagesmith-${Date.now()}.tar.gz`)\n const tmpExtract = mkdtempSync(join(tmpdir(), 'pagesmith-'))\n\n try {\n writeFileSync(tmpFile, Buffer.from(await response.arrayBuffer()))\n\n // Extract full tarball\n execSync(`tar xzf ${tmpFile} -C ${tmpExtract}`, { stdio: 'pipe' })\n\n // Find the extracted top-level directory\n const dirs = readdirSync(tmpExtract)\n const topDir = dirs[0]\n if (!topDir) throw new Error('Empty tarball')\n\n const sourcePath = join(tmpExtract, topDir, templatePath)\n if (!existsSync(sourcePath)) {\n throw new Error(`Template path not found in repo: ${templatePath}`)\n }\n\n mkdirSync(destination, { recursive: true })\n cpSync(sourcePath, destination, { recursive: true })\n } finally {\n unlinkSync(tmpFile)\n rmSync(tmpExtract, { recursive: true, force: true })\n }\n}\n\nfunction adaptForStandalone(destination: string, template: Template): void {\n // Update content.config.mjs paths (from ./posts to ./content/posts)\n const configPath = join(destination, 'content.config.mjs')\n if (existsSync(configPath)) {\n let config = readFileSync(configPath, 'utf-8')\n config = config.replace(/directory: '\\.\\/posts'/g, \"directory: './content/posts'\")\n config = config.replace(/directory: '\\.\\/pages'/g, \"directory: './content/pages'\")\n config = config.replace(/directory: '\\.\\/authors'/g, \"directory: './content/authors'\")\n config = config.replace(/directory: '\\.\\/config'/g, \"directory: './content/config'\")\n writeFileSync(configPath, config)\n }\n\n // Update vite.config.ts shared-content references\n const viteConfigPath = join(destination, 'vite.config.ts')\n if (existsSync(viteConfigPath)) {\n let config = readFileSync(viteConfigPath, 'utf-8')\n config = config.replace(\n /import content from '\\.\\.\\/shared-content\\/content\\.config'/g,\n \"import content from './content.config.mjs'\",\n )\n config = config.replace(\n /configPath:\\s*'\\.\\.\\/shared-content\\/content\\.config\\.ts'/g,\n \"configPath: './content.config.mjs'\",\n )\n config = config.replace(\n /root:\\s*resolve\\(import\\.meta\\.dirname,\\s*'\\.\\.\\/shared-content'\\)/g,\n 'root: import.meta.dirname',\n )\n writeFileSync(viteConfigPath, config)\n }\n\n // Update build.mjs (remove shared-content references)\n const buildPath = join(destination, 'build.mjs')\n if (existsSync(buildPath)) {\n let script = readFileSync(buildPath, 'utf-8')\n // Replace shared-content imports\n script = script.replace(\n /import .* from '\\.\\.\\/shared-content\\/content\\.config\\.mjs'/g,\n \"import content from './content.config.mjs'\",\n )\n // Simplify content layer setup\n script = script.replace(\n /const contentRoot = resolve\\(root, '\\.\\.\\/shared-content'\\)/g,\n 'const contentRoot = root',\n )\n // Fix named imports\n script = script.replace(\n /import \\{ pages, posts \\} from '\\.\\.\\/shared-content\\/content\\.config\\.mjs'/g,\n \"import content from './content.config.mjs'\\nconst { pages, posts } = content\",\n )\n writeFileSync(buildPath, script)\n }\n\n // Remove workspace-specific tsconfig paths\n const tsconfigPath = join(destination, 'tsconfig.json')\n if (existsSync(tsconfigPath)) {\n const tsconfig = JSON.parse(readFileSync(tsconfigPath, 'utf-8'))\n if (tsconfig.compilerOptions?.paths) {\n delete tsconfig.compilerOptions.paths\n }\n writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2) + '\\n')\n }\n}\n\nfunction writePackageJson(destination: string, projectName: string, template: Template): void {\n const existingPkg = join(destination, 'package.json')\n let pkg: Record<string, any> = {}\n\n if (existsSync(existingPkg)) {\n pkg = JSON.parse(readFileSync(existingPkg, 'utf-8'))\n }\n\n pkg.name = projectName\n pkg.private = true\n pkg.type = 'module'\n pkg.version = '0.0.0'\n pkg.scripts = template.scripts\n\n // Replace workspace \"*\" deps with actual versions\n if (pkg.dependencies) {\n for (const [name, version] of Object.entries(pkg.dependencies)) {\n if (version === '*' && name.startsWith('@pagesmith/')) {\n pkg.dependencies[name] = getPackageVersion()\n }\n }\n }\n\n // Ensure the primary dependency is present\n pkg.dependencies = pkg.dependencies ?? {}\n pkg.dependencies[template.dependency] = getPackageVersion()\n\n // Keep Vite+ in standalone examples that already use it\n if (pkg.devDependencies?.vite && !pkg.devDependencies['vite-plus']) {\n pkg.devDependencies['vite-plus'] = '^0.1.13'\n }\n\n pkg.packageManager = 'npm@11.12.0'\n\n writeFileSync(existingPkg, JSON.stringify(pkg, null, 2) + '\\n')\n}\n\nexport async function createProject(projectName: string, templateName: string): Promise<void> {\n const template = templates.find((t) => t.name === templateName)\n if (!template) {\n throw new Error(`Unknown template \"${templateName}\". Available templates:\\n${listTemplates()}`)\n }\n\n const destination = resolve(projectName)\n if (existsSync(destination) && readdirSync(destination).length > 0) {\n throw new Error(`Directory \"${projectName}\" already exists and is not empty.`)\n }\n\n if (template.source === 'local') {\n const templateDir = resolve(\n import.meta.dirname,\n '../../templates',\n template.path.split('/').pop()!,\n )\n mkdirSync(destination, { recursive: true })\n cpSync(templateDir, destination, { recursive: true })\n } else {\n await downloadFromGithub(template.path, destination)\n adaptForStandalone(destination, template)\n }\n\n writePackageJson(destination, projectName, template)\n\n console.log(`\\nCreated \"${projectName}\" from the \"${template.name}\" template.\\n`)\n console.log('Next steps:')\n console.log(` cd ${projectName}`)\n console.log(' vp install')\n if (template.scripts.dev) {\n console.log(` vp run dev`)\n } else {\n console.log(` vp run build`)\n }\n console.log()\n}\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,cAAc;AAEpB,SAAS,oBAA4B;AACnC,KAAI;EACF,MAAM,UAAU,QAAQ,OAAO,KAAK,SAAS,MAAM,MAAM,eAAe;AAExE,SAAO,IADK,KAAK,MAAM,aAAa,SAAS,QAAQ,CAAC,CACvC,WAAW;SACpB;AACN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KAAK;;AAGjE,eAAsB,cAAc,aAAqB,cAAqC;CAC5F,MAAM,WAAW,UAAU,MAAM,MAAM,EAAE,SAAS,aAAa;AAC/D,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,qBAAqB,aAAa,2BAA2B,eAAe,GAAG;CAGjG,MAAM,cAAc,QAAQ,YAAY;AACxC,KAAI,WAAW,YAAY,IAAI,YAAY,YAAY,CAAC,SAAS,EAC/D,OAAM,IAAI,MAAM,cAAc,YAAY,oCAAoC;AAGhF,KAAI,SAAS,WAAW,SAAS;EAC/B,MAAM,cAAc,QAClB,OAAO,KAAK,SACZ,mBACA,SAAS,KAAK,MAAM,IAAI,CAAC,KAAK,CAC/B;AACD,YAAU,aAAa,EAAE,WAAW,MAAM,CAAC;AAC3C,SAAO,aAAa,aAAa,EAAE,WAAW,MAAM,CAAC;QAChD;AACL,QAAM,mBAAmB,SAAS,MAAM,YAAY;AACpD,qBAAmB,aAAa,SAAS;;AAG3C,kBAAiB,aAAa,aAAa,SAAS;AAEpD,SAAQ,IAAI,cAAc,YAAY,cAAc,SAAS,KAAK,eAAe;AACjF,SAAQ,IAAI,cAAc;AAC1B,SAAQ,IAAI,QAAQ,cAAc;AAClC,SAAQ,IAAI,eAAe;AAC3B,KAAI,SAAS,QAAQ,IACnB,SAAQ,IAAI,eAAe;KAE3B,SAAQ,IAAI,iBAAiB;AAE/B,SAAQ,KAAK"}
@@ -1,2 +1,2 @@
1
- import { t as buildCss } from "../index-CeNDTM-y.mjs";
1
+ import { n as buildCss } from "../index-B7NRZAxd.mjs";
2
2
  export { buildCss };
@@ -1,2 +1,2 @@
1
- import { t as buildCss } from "../css-ekIt2Fdb.mjs";
1
+ import { t as buildCss } from "../css-BneO430t.mjs";
2
2
  export { buildCss };
@@ -2,13 +2,14 @@ import { resolve } from "path";
2
2
  import { bundle } from "lightningcss";
3
3
  //#region src/css/builder.ts
4
4
  function buildCss(entryPath, config) {
5
+ const targets = config?.targets ?? {};
5
6
  const { code } = bundle({
6
7
  filename: resolve(entryPath),
7
8
  minify: config?.minify ?? true,
8
9
  targets: {
9
- chrome: 8060928,
10
- firefox: 7864320,
11
- safari: 18 << 16
10
+ chrome: (targets.chrome ?? 123) << 16,
11
+ firefox: (targets.firefox ?? 120) << 16,
12
+ safari: (targets.safari ?? 18) << 16
12
13
  }
13
14
  });
14
15
  return new TextDecoder().decode(code);
@@ -16,4 +17,4 @@ function buildCss(entryPath, config) {
16
17
  //#endregion
17
18
  export { buildCss as t };
18
19
 
19
- //# sourceMappingURL=css-ekIt2Fdb.mjs.map
20
+ //# sourceMappingURL=css-BneO430t.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-BneO430t.mjs","names":[],"sources":["../src/css/builder.ts"],"sourcesContent":["import { bundle } from 'lightningcss'\nimport { resolve } from 'path'\n\nexport type CssBuildOptions = {\n minify?: boolean\n targets?: {\n chrome?: number\n firefox?: number\n safari?: number\n }\n}\n\nexport function buildCss(entryPath: string, config?: CssBuildOptions): string {\n const targets = config?.targets ?? {}\n const { code } = bundle({\n filename: resolve(entryPath),\n minify: config?.minify ?? true,\n targets: {\n chrome: (targets.chrome ?? 123) << 16,\n firefox: (targets.firefox ?? 120) << 16,\n safari: (targets.safari ?? 18) << 16,\n },\n })\n return new TextDecoder().decode(code)\n}\n"],"mappings":";;;AAYA,SAAgB,SAAS,WAAmB,QAAkC;CAC5E,MAAM,UAAU,QAAQ,WAAW,EAAE;CACrC,MAAM,EAAE,SAAS,OAAO;EACtB,UAAU,QAAQ,UAAU;EAC5B,QAAQ,QAAQ,UAAU;EAC1B,SAAS;GACP,SAAS,QAAQ,UAAU,QAAQ;GACnC,UAAU,QAAQ,WAAW,QAAQ;GACrC,SAAS,QAAQ,UAAU,OAAO;GACnC;EACF,CAAC;AACF,QAAO,IAAI,aAAa,CAAC,OAAO,KAAK"}
@@ -0,0 +1,13 @@
1
+ //#region src/css/builder.d.ts
2
+ type CssBuildOptions = {
3
+ minify?: boolean;
4
+ targets?: {
5
+ chrome?: number;
6
+ firefox?: number;
7
+ safari?: number;
8
+ };
9
+ };
10
+ declare function buildCss(entryPath: string, config?: CssBuildOptions): string;
11
+ //#endregion
12
+ export { buildCss as n, CssBuildOptions as t };
13
+ //# sourceMappingURL=index-B7NRZAxd.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-B7NRZAxd.d.mts","names":[],"sources":["../src/css/builder.ts"],"mappings":";KAGY,eAAA;EACV,MAAA;EACA,OAAA;IACE,MAAA;IACA,OAAA;IACA,MAAA;EAAA;AAAA;AAAA,iBAIY,QAAA,CAAS,SAAA,UAAmB,MAAA,GAAS,eAAA"}
@@ -38,4 +38,4 @@ declare const BlogFrontmatterSchema: z.ZodObject<{
38
38
  type BlogFrontmatter = z.infer<typeof BlogFrontmatterSchema>;
39
39
  //#endregion
40
40
  export { ProjectFrontmatter as a, BlogFrontmatterSchema as i, BaseFrontmatterSchema as n, ProjectFrontmatterSchema as o, BlogFrontmatter as r, BaseFrontmatter as t };
41
- //# sourceMappingURL=index-D79hUFbK.d.mts.map
41
+ //# sourceMappingURL=index-C0QFHYwb.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-D79hUFbK.d.mts","names":[],"sources":["../src/schemas/frontmatter.ts"],"mappings":";;;cAIa,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;;;;;;KAWtB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;AAAA,cAIhC,wBAAA,EAAwB,CAAA,CAAA,SAAA;;;;;;;;;;;;;KAYzB,kBAAA,GAAqB,CAAA,CAAE,KAAA,QAAa,wBAAA;AAAA,cAInC,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;;;;;;;;;KAMtB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA"}
1
+ {"version":3,"file":"index-C0QFHYwb.d.mts","names":[],"sources":["../src/schemas/frontmatter.ts"],"mappings":";;;cAIa,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;;;;;;KAWtB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;AAAA,cAIhC,wBAAA,EAAwB,CAAA,CAAA,SAAA;;;;;;;;;;;;;KAYzB,kBAAA,GAAqB,CAAA,CAAE,KAAA,QAAa,wBAAA;AAAA,cAInC,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;;;;;;;;;KAMtB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA"}
@@ -4,7 +4,7 @@ import { r as MarkdownConfig, t as Heading } from "./heading-Dhvzlay-.mjs";
4
4
  type MarkdownResult = {
5
5
  html: string;
6
6
  headings: Heading[];
7
- frontmatter: Record<string, any>;
7
+ frontmatter: Record<string, unknown>;
8
8
  };
9
9
  declare function processMarkdown(raw: string, config?: MarkdownConfig, preExtracted?: {
10
10
  content: string;
@@ -12,4 +12,4 @@ declare function processMarkdown(raw: string, config?: MarkdownConfig, preExtrac
12
12
  }): Promise<MarkdownResult>;
13
13
  //#endregion
14
14
  export { processMarkdown as n, MarkdownResult as t };
15
- //# sourceMappingURL=index-DpRBzO8Q.d.mts.map
15
+ //# sourceMappingURL=index-CJkBs8YQ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CJkBs8YQ.d.mts","names":[],"sources":["../src/markdown/pipeline.ts"],"mappings":";;;KAuBY,cAAA;EACV,IAAA;EACA,QAAA,EAAU,OAAA;EACV,WAAA,EAAa,MAAA;AAAA;AAAA,iBAoJO,eAAA,CACpB,GAAA,UACA,MAAA,GAAS,cAAA,EACT,YAAA;EAAiB,OAAA;EAAiB,WAAA,EAAa,MAAA;AAAA,IAC9C,OAAA,CAAQ,cAAA"}
@@ -50,10 +50,12 @@ declare class YamlLoader implements Loader {
50
50
  }
51
51
  //#endregion
52
52
  //#region src/loaders/index.d.ts
53
+ /** Register a custom loader by name. */
54
+ declare function registerLoader(name: string, loader: Loader): void;
53
55
  /** Resolve a loader type string or custom Loader instance. */
54
56
  declare function resolveLoader(loaderOrType: LoaderType | Loader): Loader;
55
57
  /** Get default include glob patterns for a loader. */
56
58
  declare function defaultIncludePatterns(loader: Loader): string[];
57
59
  //#endregion
58
- export { MarkdownLoader as a, JsonLoader as c, TomlLoader as i, resolveLoader as n, LoaderError as o, YamlLoader as r, JsoncLoader as s, defaultIncludePatterns as t };
59
- //# sourceMappingURL=index-Dbsw1QON.d.mts.map
60
+ export { TomlLoader as a, JsoncLoader as c, YamlLoader as i, JsonLoader as l, registerLoader as n, MarkdownLoader as o, resolveLoader as r, LoaderError as s, defaultIncludePatterns as t };
61
+ //# sourceMappingURL=index-DCznbvaV.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-Dbsw1QON.d.mts","names":[],"sources":["../src/loaders/json.ts","../src/loaders/jsonc.ts","../src/loaders/errors.ts","../src/loaders/markdown.ts","../src/loaders/toml.ts","../src/loaders/yaml.ts","../src/loaders/index.ts"],"mappings":";;;cAWa,UAAA,YAAsB,MAAA;EACjC,IAAA;EACA,IAAA;EACA,UAAA;EAEM,IAAA,CAAK,QAAA,WAAmB,OAAA,CAAQ,YAAA;AAAA;;;cCoC3B,WAAA,YAAuB,MAAA;EAClC,IAAA;EACA,IAAA;EACA,UAAA;EAEM,IAAA,CAAK,QAAA,WAAmB,OAAA,CAAQ,YAAA;AAAA;;;cCzD3B,WAAA,SAAoB,KAAA;EAAA,SACtB,QAAA;EAAA,SACA,MAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;cAEG,OAAA,UAAiB,QAAA,UAAkB,MAAA,UAAgB,IAAA,WAAe,MAAA;AAAA;;;cCOnE,cAAA,YAA0B,MAAA;EACrC,IAAA;EACA,IAAA;EACA,UAAA;EAEM,IAAA,CAAK,QAAA,WAAmB,OAAA,CAAQ,YAAA;AAAA;;;cCT3B,UAAA,YAAsB,MAAA;EACjC,IAAA;EACA,IAAA;EACA,UAAA;EAEM,IAAA,CAAK,QAAA,WAAmB,OAAA,CAAQ,YAAA;AAAA;;;cCL3B,UAAA,YAAsB,MAAA;EACjC,IAAA;EACA,IAAA;EACA,UAAA;EAEM,IAAA,CAAK,QAAA,WAAmB,OAAA,CAAQ,YAAA;AAAA;;;;iBCaxB,aAAA,CAAc,YAAA,EAAc,UAAA,GAAa,MAAA,GAAS,MAAA;;iBAqBlD,sBAAA,CAAuB,MAAA,EAAQ,MAAA"}
1
+ {"version":3,"file":"index-DCznbvaV.d.mts","names":[],"sources":["../src/loaders/json.ts","../src/loaders/jsonc.ts","../src/loaders/errors.ts","../src/loaders/markdown.ts","../src/loaders/toml.ts","../src/loaders/yaml.ts","../src/loaders/index.ts"],"mappings":";;;cAWa,UAAA,YAAsB,MAAA;EACjC,IAAA;EACA,IAAA;EACA,UAAA;EAEM,IAAA,CAAK,QAAA,WAAmB,OAAA,CAAQ,YAAA;AAAA;;;cCoC3B,WAAA,YAAuB,MAAA;EAClC,IAAA;EACA,IAAA;EACA,UAAA;EAEM,IAAA,CAAK,QAAA,WAAmB,OAAA,CAAQ,YAAA;AAAA;;;cCzD3B,WAAA,SAAoB,KAAA;EAAA,SACtB,QAAA;EAAA,SACA,MAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;cAEG,OAAA,UAAiB,QAAA,UAAkB,MAAA,UAAgB,IAAA,WAAe,MAAA;AAAA;;;cCOnE,cAAA,YAA0B,MAAA;EACrC,IAAA;EACA,IAAA;EACA,UAAA;EAEM,IAAA,CAAK,QAAA,WAAmB,OAAA,CAAQ,YAAA;AAAA;;;cCT3B,UAAA,YAAsB,MAAA;EACjC,IAAA;EACA,IAAA;EACA,UAAA;EAEM,IAAA,CAAK,QAAA,WAAmB,OAAA,CAAQ,YAAA;AAAA;;;cCL3B,UAAA,YAAsB,MAAA;EACjC,IAAA;EACA,IAAA;EACA,UAAA;EAEM,IAAA,CAAK,QAAA,WAAmB,OAAA,CAAQ,YAAA;AAAA;;;;iBCgBxB,cAAA,CAAe,IAAA,UAAc,MAAA,EAAQ,MAAA;;iBAKrC,aAAA,CAAc,YAAA,EAAc,UAAA,GAAa,MAAA,GAAS,MAAA;;iBAwBlD,sBAAA,CAAuB,MAAA,EAAQ,MAAA"}
package/dist/index.d.mts CHANGED
@@ -1,12 +1,12 @@
1
- import { AiArtifact, AiArtifactKind, AiAssistant, AiInstallOptions, AiInstallResult, AiInstallScope, getAiArtifactContent, getAiArtifacts, installAiArtifacts } from "./ai/index.mjs";
2
- import { t as buildCss } from "./index-CeNDTM-y.mjs";
1
+ import { n as buildCss, t as CssBuildOptions } from "./index-B7NRZAxd.mjs";
3
2
  import { n as LoaderResult, r as LoaderType, t as Loader } from "./types-B-V5qemH.mjs";
4
- import { a as CollectionMap, c as RawEntry, d as ValidationEntryResult, f as ValidationIssue, i as CollectionDef, l as ContentValidator, n as ContentPlugin, o as InferCollectionData, p as ValidationResult, r as CollectionComputed, s as InferCollectionLoaderKind, t as ContentLayerConfig, u as ValidatorContext } from "./content-config-wW-3r5gG.mjs";
3
+ import { a as CollectionMap, c as RawEntry, d as ValidatorContext, f as ValidationEntryResult, i as CollectionDef, l as ContentValidator, m as ValidationResult, n as ContentPlugin, o as InferCollectionData, p as ValidationIssue, r as CollectionComputed, s as InferCollectionLoaderKind, t as ContentLayerConfig, u as ResolvedValidatorContext } from "./content-config-DJXUOcNG.mjs";
5
4
  import { i as MarkdownConfigSchema, n as HeadingSchema, r as MarkdownConfig, t as Heading } from "./heading-Dhvzlay-.mjs";
5
+ import { _ as ConvertResult, a as WatchEvent, c as builtinMarkdownValidators, d as linkValidator, f as headingValidator, g as ConvertOptions, h as RenderedContent, i as WatchCallback, l as runValidators, m as ContentEntry, n as LayerConvertOptions, o as WatchHandle, p as codeBlockValidator, r as TypedContentLayer, s as createContentLayer, t as ContentLayer, u as createLinkValidator, v as convert } from "./content-layer-CpHYUYNN.mjs";
6
6
  import { Fragment, HtmlString, h } from "./jsx-runtime/index.mjs";
7
- import { n as processMarkdown, t as MarkdownResult } from "./index-DpRBzO8Q.mjs";
8
- import { a as ProjectFrontmatter, i as BlogFrontmatterSchema, n as BaseFrontmatterSchema, o as ProjectFrontmatterSchema, r as BlogFrontmatter, t as BaseFrontmatter } from "./index-D79hUFbK.mjs";
9
- import { a as MarkdownLoader, c as JsonLoader, i as TomlLoader, r as YamlLoader, s as JsoncLoader } from "./index-Dbsw1QON.mjs";
7
+ import { n as processMarkdown, t as MarkdownResult } from "./index-CJkBs8YQ.mjs";
8
+ import { a as ProjectFrontmatter, i as BlogFrontmatterSchema, n as BaseFrontmatterSchema, o as ProjectFrontmatterSchema, r as BlogFrontmatter, t as BaseFrontmatter } from "./index-C0QFHYwb.mjs";
9
+ import { a as TomlLoader, c as JsoncLoader, i as YamlLoader, l as JsonLoader, n as registerLoader, o as MarkdownLoader } from "./index-DCznbvaV.mjs";
10
10
  import { ZodSchema, z, z as z$1 } from "zod";
11
11
 
12
12
  //#region src/config.d.ts
@@ -19,89 +19,6 @@ declare function defineCollection<const S extends z$1.ZodType, const TComputed e
19
19
  /** Define a named collection map with strong literal inference. */
20
20
  declare function defineCollections<const TCollections extends CollectionMap>(collections: TCollections): TCollections;
21
21
  //#endregion
22
- //#region src/convert.d.ts
23
- type ConvertOptions = {
24
- markdown?: MarkdownConfig;
25
- };
26
- type ConvertResult = {
27
- html: string;
28
- toc: Heading[];
29
- frontmatter: Record<string, any>;
30
- };
31
- declare function convert(input: string, options?: ConvertOptions): Promise<ConvertResult>;
32
- //#endregion
33
- //#region src/entry.d.ts
34
- type RenderedContent = {
35
- /** Processed HTML */html: string; /** Extracted headings for TOC */
36
- headings: Heading[]; /** Estimated read time in minutes */
37
- readTime: number;
38
- };
39
- declare class ContentEntry<T = Record<string, any>> {
40
- /** URL-friendly identifier */
41
- readonly slug: string;
42
- /** Collection this entry belongs to */
43
- readonly collection: string;
44
- /** Absolute path to source file */
45
- readonly filePath: string;
46
- /** Validated data (frontmatter or parsed data) */
47
- readonly data: T;
48
- /** Raw body content (markdown only) */
49
- readonly rawContent?: string;
50
- /** Cached render result */
51
- private _rendered?;
52
- /** Markdown config for rendering */
53
- private _markdownConfig;
54
- constructor(slug: string, collection: string, filePath: string, data: T, rawContent: string | undefined, markdownConfig: MarkdownConfig);
55
- /** Render the entry content to HTML. Cached after first call. */
56
- render(options?: {
57
- force?: boolean;
58
- }): Promise<RenderedContent>;
59
- /** Clear cached render result. */
60
- clearRenderCache(): void;
61
- }
62
- //#endregion
63
- //#region src/validation/code-block-validator.d.ts
64
- declare const codeBlockValidator: ContentValidator;
65
- //#endregion
66
- //#region src/validation/heading-validator.d.ts
67
- declare const headingValidator: ContentValidator;
68
- //#endregion
69
- //#region src/validation/link-validator.d.ts
70
- declare const linkValidator: ContentValidator;
71
- //#endregion
72
- //#region src/validation/runner.d.ts
73
- /** The built-in validators for markdown content. */
74
- declare const builtinMarkdownValidators: ContentValidator[];
75
- /** Run all validators on a single content entry. */
76
- declare function runValidators(ctx: ValidatorContext, validators: ContentValidator[]): Promise<ValidationIssue[]>;
77
- //#endregion
78
- //#region src/content-layer.d.ts
79
- interface ContentLayer {
80
- /** Get all entries in a collection. */
81
- getCollection(name: string): Promise<ContentEntry<any>[]>;
82
- /** Get a single entry by collection name and slug. */
83
- getEntry(collection: string, slug: string): Promise<ContentEntry<any> | undefined>;
84
- /** Convert raw markdown to HTML (no collection, no validation). */
85
- convert(markdown: string, options?: LayerConvertOptions): Promise<ConvertResult>;
86
- /** Invalidate a single entry's cache. */
87
- invalidate(collection: string, slug: string): Promise<void>;
88
- /** Invalidate an entire collection's cache. */
89
- invalidateCollection(collection: string): void;
90
- /** Invalidate all cached data. */
91
- invalidateAll(): void;
92
- /** Validate all entries in a collection (or all collections). */
93
- validate(collection?: string): Promise<ValidationResult[]>;
94
- /** Get the names of all configured collections. */
95
- getCollectionNames(): string[];
96
- /** Get the definition of a collection. */
97
- getCollectionDef(name: string): CollectionDef | undefined;
98
- }
99
- type LayerConvertOptions = {
100
- markdown?: MarkdownConfig;
101
- };
102
- /** Create a new content layer from a configuration. */
103
- declare function createContentLayer(config: ContentLayerConfig): ContentLayer;
104
- //#endregion
105
22
  //#region src/frontmatter.d.ts
106
23
  type FrontmatterResult = {
107
24
  frontmatter: Record<string, any>;
@@ -109,7 +26,12 @@ type FrontmatterResult = {
109
26
  };
110
27
  /** Extract frontmatter from raw markdown using gray-matter. */
111
28
  declare function extractFrontmatter(raw: string): FrontmatterResult;
112
- /** Validate frontmatter against a Zod schema. Returns parsed data or throws. */
29
+ /**
30
+ * Validate frontmatter against a Zod schema. Returns parsed data or errors.
31
+ *
32
+ * @deprecated Use `validateSchema()` from `@pagesmith/core` for richer
33
+ * validation results including field paths and severity levels.
34
+ */
113
35
  declare function validateFrontmatter<T>(frontmatter: Record<string, any>, schema: ZodSchema<T>): {
114
36
  success: true;
115
37
  data: T;
@@ -127,5 +49,5 @@ declare function validateFrontmatter<T>(frontmatter: Record<string, any>, schema
127
49
  */
128
50
  declare function extractToc(html: string): Heading[];
129
51
  //#endregion
130
- export { type AiArtifact, type AiArtifactKind, type AiAssistant, type AiInstallOptions, type AiInstallResult, type AiInstallScope, type BaseFrontmatter, BaseFrontmatterSchema, type BlogFrontmatter, BlogFrontmatterSchema, type CollectionComputed, type CollectionDef, type CollectionMap, ContentEntry, type ContentLayer, type ContentLayerConfig, type ContentPlugin, type ContentValidator, type ConvertOptions, type ConvertResult, Fragment, type FrontmatterResult, type Heading, HeadingSchema, HtmlString, type InferCollectionData, type InferCollectionLoaderKind, JsonLoader, JsoncLoader, type LayerConvertOptions, type Loader, type LoaderResult, type LoaderType, type MarkdownConfig, MarkdownConfigSchema, MarkdownLoader, type MarkdownResult, type ProjectFrontmatter, ProjectFrontmatterSchema, type RawEntry, type RenderedContent, TomlLoader, type ValidationEntryResult, type ValidationIssue, type ValidationResult, type ValidatorContext, YamlLoader, buildCss, builtinMarkdownValidators, codeBlockValidator, convert, createContentLayer, defineCollection, defineCollections, defineConfig, extractFrontmatter, extractToc, getAiArtifactContent, getAiArtifacts, h, headingValidator, installAiArtifacts, linkValidator, processMarkdown, runValidators, validateFrontmatter, z };
52
+ export { type BaseFrontmatter, BaseFrontmatterSchema, type BlogFrontmatter, BlogFrontmatterSchema, type CollectionComputed, type CollectionDef, type CollectionMap, ContentEntry, type ContentLayer, type ContentLayerConfig, type ContentPlugin, type ContentValidator, type ConvertOptions, type ConvertResult, type CssBuildOptions, Fragment, type FrontmatterResult, type Heading, HeadingSchema, HtmlString, type InferCollectionData, type InferCollectionLoaderKind, JsonLoader, JsoncLoader, type LayerConvertOptions, type Loader, type LoaderResult, type LoaderType, type MarkdownConfig, MarkdownConfigSchema, MarkdownLoader, type MarkdownResult, type ProjectFrontmatter, ProjectFrontmatterSchema, type RawEntry, type RenderedContent, type ResolvedValidatorContext, TomlLoader, type TypedContentLayer, type ValidationEntryResult, type ValidationIssue, type ValidationResult, type ValidatorContext, type WatchCallback, type WatchEvent, type WatchHandle, YamlLoader, buildCss, builtinMarkdownValidators, codeBlockValidator, convert, createContentLayer, createLinkValidator, defineCollection, defineCollections, defineConfig, extractFrontmatter, extractToc, h, headingValidator, linkValidator, processMarkdown, registerLoader, runValidators, validateFrontmatter, z };
131
53
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/config.ts","../src/convert.ts","../src/entry.ts","../src/validation/code-block-validator.ts","../src/validation/heading-validator.ts","../src/validation/link-validator.ts","../src/validation/runner.ts","../src/content-layer.ts","../src/frontmatter.ts","../src/toc.ts"],"mappings":";;;;;;;;;;;;;iBAagB,YAAA,CAAa,MAAA,EAAQ,kBAAA,GAAqB,kBAAA;AAA1D;AAAA,iBAKgB,gBAAA,iBACE,GAAA,CAAE,OAAA,0BACM,kBAAA,6BACF,UAAA,GAAa,MAAA,GAAS,UAAA,GAAa,MAAA,CAAA,CAEzD,GAAA,EAAK,IAAA,CAAK,aAAA,CAAc,CAAA,EAAG,SAAA,EAAW,OAAA;EACpC,QAAA,GAAW,SAAA,GAAY,kBAAA;AAAA,IAExB,aAAA,CAAc,CAAA,EAAG,SAAA,EAAW,OAAA;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A,CAAmB,GAAA,WAAc,iBAAA;;;;;;;iBAWjC,mBAAA,GAAA,CACd,WAAA,EAAa,MAAA,eACb,MAAA,EAAQ,SAAA,CAAU,CAAA;EACf,OAAA;EAAe,IAAA,EAAM,CAAA;AAAA;EAAQ,OAAA;EAAgB,MAAA;AAAA;;;;;;;;;iBCxBlC,UAAA,CAAW,IAAA,WAAe,OAAA"}
package/dist/index.mjs CHANGED
@@ -1,11 +1,9 @@
1
- import { t as convert } from "./convert-XdGgNqH0.mjs";
2
- import { t as processMarkdown } from "./markdown-Cj5X26FL.mjs";
3
- import { a as headingValidator, c as ContentEntry, i as linkValidator, n as builtinMarkdownValidators, o as codeBlockValidator, r as runValidators, t as createContentLayer } from "./content-layer-DWdgdBeI.mjs";
4
- import { a as MarkdownLoader, i as TomlLoader, o as JsoncLoader, r as YamlLoader, s as JsonLoader } from "./loaders-Bla48ZN9.mjs";
1
+ import { t as processMarkdown } from "./markdown-BmDJgYeB.mjs";
2
+ import { a as linkValidator, c as validateSchema, d as convert, i as createLinkValidator, n as builtinMarkdownValidators, o as headingValidator, r as runValidators, s as codeBlockValidator, t as createContentLayer, u as ContentEntry } from "./content-layer-B5enqWeJ.mjs";
3
+ import { a as TomlLoader, c as JsonLoader, i as YamlLoader, n as registerLoader, o as MarkdownLoader, s as JsoncLoader } from "./loaders-Cf-BXf2L.mjs";
5
4
  import { Fragment, HtmlString, h } from "./jsx-runtime/index.mjs";
6
- import { t as buildCss } from "./css-ekIt2Fdb.mjs";
7
- import { a as ProjectFrontmatterSchema, i as BlogFrontmatterSchema, n as HeadingSchema, r as BaseFrontmatterSchema, t as MarkdownConfigSchema } from "./schemas-BZEPTGWs.mjs";
8
- import { getAiArtifactContent, getAiArtifacts, installAiArtifacts } from "./ai/index.mjs";
5
+ import { t as buildCss } from "./css-BneO430t.mjs";
6
+ import { a as ProjectFrontmatterSchema, i as BlogFrontmatterSchema, n as HeadingSchema, r as BaseFrontmatterSchema, t as MarkdownConfigSchema } from "./schemas-UL4ynWsA.mjs";
9
7
  import matter from "gray-matter";
10
8
  import { parse } from "yaml";
11
9
  import { z } from "zod";
@@ -38,16 +36,21 @@ function extractFrontmatter(raw) {
38
36
  content
39
37
  };
40
38
  }
41
- /** Validate frontmatter against a Zod schema. Returns parsed data or throws. */
39
+ /**
40
+ * Validate frontmatter against a Zod schema. Returns parsed data or errors.
41
+ *
42
+ * @deprecated Use `validateSchema()` from `@pagesmith/core` for richer
43
+ * validation results including field paths and severity levels.
44
+ */
42
45
  function validateFrontmatter(frontmatter, schema) {
43
- const result = schema.safeParse(frontmatter);
44
- if (result.success) return {
46
+ const { issues, validatedData } = validateSchema(frontmatter, schema);
47
+ if (issues.length === 0) return {
45
48
  success: true,
46
- data: result.data
49
+ data: validatedData
47
50
  };
48
51
  return {
49
52
  success: false,
50
- errors: result.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`)
53
+ errors: issues.map((issue) => issue.field ? `${issue.field}: ${issue.message}` : issue.message)
51
54
  };
52
55
  }
53
56
  //#endregion
@@ -75,6 +78,6 @@ function extractToc(html) {
75
78
  return headings;
76
79
  }
77
80
  //#endregion
78
- export { BaseFrontmatterSchema, BlogFrontmatterSchema, ContentEntry, Fragment, HeadingSchema, HtmlString, JsonLoader, JsoncLoader, MarkdownConfigSchema, MarkdownLoader, ProjectFrontmatterSchema, TomlLoader, YamlLoader, buildCss, builtinMarkdownValidators, codeBlockValidator, convert, createContentLayer, defineCollection, defineCollections, defineConfig, extractFrontmatter, extractToc, getAiArtifactContent, getAiArtifacts, h, headingValidator, installAiArtifacts, linkValidator, processMarkdown, runValidators, validateFrontmatter, z };
81
+ export { BaseFrontmatterSchema, BlogFrontmatterSchema, ContentEntry, Fragment, HeadingSchema, HtmlString, JsonLoader, JsoncLoader, MarkdownConfigSchema, MarkdownLoader, ProjectFrontmatterSchema, TomlLoader, YamlLoader, buildCss, builtinMarkdownValidators, codeBlockValidator, convert, createContentLayer, createLinkValidator, defineCollection, defineCollections, defineConfig, extractFrontmatter, extractToc, h, headingValidator, linkValidator, processMarkdown, registerLoader, runValidators, validateFrontmatter, z };
79
82
 
80
83
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["parseYaml"],"sources":["../src/config.ts","../src/frontmatter.ts","../src/toc.ts"],"sourcesContent":["/**\n * Configuration helpers.\n *\n * defineConfig() and defineCollection() are type-safe identity functions\n * that provide TypeScript inference for collection schemas.\n */\n\nimport type { z } from 'zod'\nimport type { CollectionComputed, CollectionDef, CollectionMap } from './schemas/collection'\nimport type { Loader, LoaderType } from './loaders/types'\nimport type { ContentLayerConfig } from './schemas/content-config'\n\n/** Define a content layer configuration with type inference. */\nexport function defineConfig(config: ContentLayerConfig): ContentLayerConfig {\n return config\n}\n\n/** Define a collection with Zod schema type inference. */\nexport function defineCollection<\n const S extends z.ZodType,\n const TComputed extends CollectionComputed = {},\n const TLoader extends LoaderType | Loader = LoaderType | Loader,\n>(\n def: Omit<CollectionDef<S, TComputed, TLoader>, 'computed'> & {\n computed?: TComputed & CollectionComputed\n },\n): CollectionDef<S, TComputed, TLoader> {\n return def\n}\n\n/** Define a named collection map with strong literal inference. */\nexport function defineCollections<const TCollections extends CollectionMap>(\n collections: TCollections,\n): TCollections {\n return collections\n}\n","/**\n * Frontmatter extraction and validation.\n *\n * Uses gray-matter to parse YAML frontmatter from markdown,\n * and optionally validates against a Zod schema.\n */\n\nimport matter from 'gray-matter'\nimport { parse as parseYaml } from 'yaml'\nimport type { ZodSchema } from 'zod'\n\nexport type FrontmatterResult = {\n frontmatter: Record<string, any>\n content: string\n}\n\n/** Extract frontmatter from raw markdown using gray-matter. */\nexport function extractFrontmatter(raw: string): FrontmatterResult {\n const { data, content } = matter(raw, { engines: { yaml: parseYaml } })\n return { frontmatter: data, content }\n}\n\n/** Validate frontmatter against a Zod schema. Returns parsed data or throws. */\nexport function validateFrontmatter<T>(\n frontmatter: Record<string, any>,\n schema: ZodSchema<T>,\n): { success: true; data: T } | { success: false; errors: string[] } {\n const result = schema.safeParse(frontmatter)\n if (result.success) {\n return { success: true, data: result.data }\n }\n const errors = result.error.issues.map((issue) => `${issue.path.join('.')}: ${issue.message}`)\n return { success: false, errors }\n}\n","import type { Heading } from './schemas/heading'\n\n/**\n * Extract table of contents headings from an HTML string.\n *\n * Regex-based: finds <h[1-6] id=\"...\">text</h[1-6]>, strips inner HTML tags.\n * No dependency on unified — works on any HTML string.\n */\nexport function extractToc(html: string): Heading[] {\n const headings: Heading[] = []\n const re = /<h([1-6])\\s+id=\"([^\"]*)\"[^>]*>([\\s\\S]*?)<\\/h\\1>/gi\n let match: RegExpExecArray | null\n\n while ((match = re.exec(html)) !== null) {\n const depth = parseInt(match[1], 10)\n const slug = match[2]\n // Strip inner HTML tags to get plain text\n const text = match[3].replace(/<[^>]+>/g, '').trim()\n headings.push({ depth, text, slug })\n }\n\n return headings\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,aAAa,QAAgD;AAC3E,QAAO;;;AAIT,SAAgB,iBAKd,KAGsC;AACtC,QAAO;;;AAIT,SAAgB,kBACd,aACc;AACd,QAAO;;;;;;;;;;;ACjBT,SAAgB,mBAAmB,KAAgC;CACjE,MAAM,EAAE,MAAM,YAAY,OAAO,KAAK,EAAE,SAAS,EAAE,MAAMA,OAAW,EAAE,CAAC;AACvE,QAAO;EAAE,aAAa;EAAM;EAAS;;;AAIvC,SAAgB,oBACd,aACA,QACmE;CACnE,MAAM,SAAS,OAAO,UAAU,YAAY;AAC5C,KAAI,OAAO,QACT,QAAO;EAAE,SAAS;EAAM,MAAM,OAAO;EAAM;AAG7C,QAAO;EAAE,SAAS;EAAO,QADV,OAAO,MAAM,OAAO,KAAK,UAAU,GAAG,MAAM,KAAK,KAAK,IAAI,CAAC,IAAI,MAAM,UAAU;EAC7D;;;;;;;;;;ACxBnC,SAAgB,WAAW,MAAyB;CAClD,MAAM,WAAsB,EAAE;CAC9B,MAAM,KAAK;CACX,IAAI;AAEJ,SAAQ,QAAQ,GAAG,KAAK,KAAK,MAAM,MAAM;EACvC,MAAM,QAAQ,SAAS,MAAM,IAAI,GAAG;EACpC,MAAM,OAAO,MAAM;EAEnB,MAAM,OAAO,MAAM,GAAG,QAAQ,YAAY,GAAG,CAAC,MAAM;AACpD,WAAS,KAAK;GAAE;GAAO;GAAM;GAAM,CAAC;;AAGtC,QAAO"}
1
+ {"version":3,"file":"index.mjs","names":["parseYaml"],"sources":["../src/config.ts","../src/frontmatter.ts","../src/toc.ts"],"sourcesContent":["/**\n * Configuration helpers.\n *\n * defineConfig() and defineCollection() are type-safe identity functions\n * that provide TypeScript inference for collection schemas.\n */\n\nimport type { z } from 'zod'\nimport type { CollectionComputed, CollectionDef, CollectionMap } from './schemas/collection'\nimport type { Loader, LoaderType } from './loaders/types'\nimport type { ContentLayerConfig } from './schemas/content-config'\n\n/** Define a content layer configuration with type inference. */\nexport function defineConfig(config: ContentLayerConfig): ContentLayerConfig {\n return config\n}\n\n/** Define a collection with Zod schema type inference. */\nexport function defineCollection<\n const S extends z.ZodType,\n const TComputed extends CollectionComputed = {},\n const TLoader extends LoaderType | Loader = LoaderType | Loader,\n>(\n def: Omit<CollectionDef<S, TComputed, TLoader>, 'computed'> & {\n computed?: TComputed & CollectionComputed\n },\n): CollectionDef<S, TComputed, TLoader> {\n return def\n}\n\n/** Define a named collection map with strong literal inference. */\nexport function defineCollections<const TCollections extends CollectionMap>(\n collections: TCollections,\n): TCollections {\n return collections\n}\n","/**\n * Frontmatter extraction and validation.\n *\n * Uses gray-matter to parse YAML frontmatter from markdown,\n * and optionally validates against a Zod schema.\n */\n\nimport matter from 'gray-matter'\nimport { parse as parseYaml } from 'yaml'\nimport type { ZodSchema } from 'zod'\nimport { validateSchema } from './validation/schema-validator'\n\nexport type FrontmatterResult = {\n frontmatter: Record<string, any>\n content: string\n}\n\n/** Extract frontmatter from raw markdown using gray-matter. */\nexport function extractFrontmatter(raw: string): FrontmatterResult {\n const { data, content } = matter(raw, { engines: { yaml: parseYaml } })\n return { frontmatter: data, content }\n}\n\n/**\n * Validate frontmatter against a Zod schema. Returns parsed data or errors.\n *\n * @deprecated Use `validateSchema()` from `@pagesmith/core` for richer\n * validation results including field paths and severity levels.\n */\nexport function validateFrontmatter<T>(\n frontmatter: Record<string, any>,\n schema: ZodSchema<T>,\n): { success: true; data: T } | { success: false; errors: string[] } {\n const { issues, validatedData } = validateSchema(frontmatter, schema)\n\n if (issues.length === 0) {\n return { success: true, data: validatedData as T }\n }\n\n const errors = issues.map((issue) =>\n issue.field ? `${issue.field}: ${issue.message}` : issue.message,\n )\n return { success: false, errors }\n}\n","import type { Heading } from './schemas/heading'\n\n/**\n * Extract table of contents headings from an HTML string.\n *\n * Regex-based: finds <h[1-6] id=\"...\">text</h[1-6]>, strips inner HTML tags.\n * No dependency on unified — works on any HTML string.\n */\nexport function extractToc(html: string): Heading[] {\n const headings: Heading[] = []\n const re = /<h([1-6])\\s+id=\"([^\"]*)\"[^>]*>([\\s\\S]*?)<\\/h\\1>/gi\n let match: RegExpExecArray | null\n\n while ((match = re.exec(html)) !== null) {\n const depth = parseInt(match[1], 10)\n const slug = match[2]\n // Strip inner HTML tags to get plain text\n const text = match[3].replace(/<[^>]+>/g, '').trim()\n headings.push({ depth, text, slug })\n }\n\n return headings\n}\n"],"mappings":";;;;;;;;;;;AAaA,SAAgB,aAAa,QAAgD;AAC3E,QAAO;;;AAIT,SAAgB,iBAKd,KAGsC;AACtC,QAAO;;;AAIT,SAAgB,kBACd,aACc;AACd,QAAO;;;;;;;;;;;AChBT,SAAgB,mBAAmB,KAAgC;CACjE,MAAM,EAAE,MAAM,YAAY,OAAO,KAAK,EAAE,SAAS,EAAE,MAAMA,OAAW,EAAE,CAAC;AACvE,QAAO;EAAE,aAAa;EAAM;EAAS;;;;;;;;AASvC,SAAgB,oBACd,aACA,QACmE;CACnE,MAAM,EAAE,QAAQ,kBAAkB,eAAe,aAAa,OAAO;AAErE,KAAI,OAAO,WAAW,EACpB,QAAO;EAAE,SAAS;EAAM,MAAM;EAAoB;AAMpD,QAAO;EAAE,SAAS;EAAO,QAHV,OAAO,KAAK,UACzB,MAAM,QAAQ,GAAG,MAAM,MAAM,IAAI,MAAM,YAAY,MAAM,QAC1D;EACgC;;;;;;;;;;AClCnC,SAAgB,WAAW,MAAyB;CAClD,MAAM,WAAsB,EAAE;CAC9B,MAAM,KAAK;CACX,IAAI;AAEJ,SAAQ,QAAQ,GAAG,KAAK,KAAK,MAAM,MAAM;EACvC,MAAM,QAAQ,SAAS,MAAM,IAAI,GAAG;EACpC,MAAM,OAAO,MAAM;EAEnB,MAAM,OAAO,MAAM,GAAG,QAAQ,YAAY,GAAG,CAAC,MAAM;AACpD,WAAS,KAAK;GAAE;GAAO;GAAM;GAAM,CAAC;;AAGtC,QAAO"}
@@ -1,3 +1,3 @@
1
1
  import { n as LoaderResult, r as LoaderType, t as Loader } from "../types-B-V5qemH.mjs";
2
- import { a as MarkdownLoader, c as JsonLoader, i as TomlLoader, n as resolveLoader, o as LoaderError, r as YamlLoader, s as JsoncLoader, t as defaultIncludePatterns } from "../index-Dbsw1QON.mjs";
3
- export { JsonLoader, JsoncLoader, Loader, LoaderError, LoaderResult, LoaderType, MarkdownLoader, TomlLoader, YamlLoader, defaultIncludePatterns, resolveLoader };
2
+ import { a as TomlLoader, c as JsoncLoader, i as YamlLoader, l as JsonLoader, n as registerLoader, o as MarkdownLoader, r as resolveLoader, s as LoaderError, t as defaultIncludePatterns } from "../index-DCznbvaV.mjs";
3
+ export { JsonLoader, JsoncLoader, Loader, LoaderError, LoaderResult, LoaderType, MarkdownLoader, TomlLoader, YamlLoader, defaultIncludePatterns, registerLoader, resolveLoader };
@@ -1,2 +1,2 @@
1
- import { a as MarkdownLoader, c as LoaderError, i as TomlLoader, n as resolveLoader, o as JsoncLoader, r as YamlLoader, s as JsonLoader, t as defaultIncludePatterns } from "../loaders-Bla48ZN9.mjs";
2
- export { JsonLoader, JsoncLoader, LoaderError, MarkdownLoader, TomlLoader, YamlLoader, defaultIncludePatterns, resolveLoader };
1
+ import { a as TomlLoader, c as JsonLoader, i as YamlLoader, l as LoaderError, n as registerLoader, o as MarkdownLoader, r as resolveLoader, s as JsoncLoader, t as defaultIncludePatterns } from "../loaders-Cf-BXf2L.mjs";
2
+ export { JsonLoader, JsoncLoader, LoaderError, MarkdownLoader, TomlLoader, YamlLoader, defaultIncludePatterns, registerLoader, resolveLoader };
@@ -162,9 +162,17 @@ const jsonLoader = new JsonLoader();
162
162
  const jsoncLoader = new JsoncLoader();
163
163
  const yamlLoader = new YamlLoader();
164
164
  const tomlLoader = new TomlLoader();
165
+ /** Custom loader registry for user-registered loaders. */
166
+ const customLoaders = /* @__PURE__ */ new Map();
167
+ /** Register a custom loader by name. */
168
+ function registerLoader(name, loader) {
169
+ customLoaders.set(name, loader);
170
+ }
165
171
  /** Resolve a loader type string or custom Loader instance. */
166
172
  function resolveLoader(loaderOrType) {
167
173
  if (typeof loaderOrType === "object") return loaderOrType;
174
+ const custom = customLoaders.get(loaderOrType);
175
+ if (custom) return custom;
168
176
  switch (loaderOrType) {
169
177
  case "markdown": return markdownLoader;
170
178
  case "json":
@@ -180,6 +188,6 @@ function defaultIncludePatterns(loader) {
180
188
  return loader.extensions.map((ext) => `**/*${ext}`);
181
189
  }
182
190
  //#endregion
183
- export { MarkdownLoader as a, LoaderError as c, TomlLoader as i, resolveLoader as n, JsoncLoader as o, YamlLoader as r, JsonLoader as s, defaultIncludePatterns as t };
191
+ export { TomlLoader as a, JsonLoader as c, YamlLoader as i, LoaderError as l, registerLoader as n, MarkdownLoader as o, resolveLoader as r, JsoncLoader as s, defaultIncludePatterns as t };
184
192
 
185
- //# sourceMappingURL=loaders-Bla48ZN9.mjs.map
193
+ //# sourceMappingURL=loaders-Cf-BXf2L.mjs.map