vaza-content 0.3.1 → 0.3.3

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 (45) hide show
  1. package/dist/adapters/astro/index.cjs +4 -4
  2. package/dist/adapters/astro/index.d.cts +1 -1
  3. package/dist/adapters/astro/index.d.ts +1 -1
  4. package/dist/adapters/astro/index.js +2 -2
  5. package/dist/adapters/next/index.cjs +5 -5
  6. package/dist/adapters/next/index.d.cts +1 -1
  7. package/dist/adapters/next/index.d.ts +1 -1
  8. package/dist/adapters/next/index.js +2 -2
  9. package/dist/adapters/nuxt/index.cjs +5 -5
  10. package/dist/adapters/nuxt/index.d.cts +1 -1
  11. package/dist/adapters/nuxt/index.d.ts +1 -1
  12. package/dist/adapters/nuxt/index.js +2 -2
  13. package/dist/adapters/sveltekit/index.cjs +4 -4
  14. package/dist/adapters/sveltekit/index.d.cts +1 -1
  15. package/dist/adapters/sveltekit/index.d.ts +1 -1
  16. package/dist/adapters/sveltekit/index.js +2 -2
  17. package/dist/{chunk-WMZ2V72R.cjs → chunk-2WP6WC4I.cjs} +41 -16
  18. package/dist/chunk-2WP6WC4I.cjs.map +1 -0
  19. package/dist/{chunk-ENRQYMG7.js → chunk-GEINM3H6.js} +149 -45
  20. package/dist/chunk-GEINM3H6.js.map +1 -0
  21. package/dist/{chunk-HRA5O4XV.js → chunk-HGTGVVB5.js} +30 -5
  22. package/dist/chunk-HGTGVVB5.js.map +1 -0
  23. package/dist/{chunk-XPYCZ2EO.cjs → chunk-SP3ZSAOU.cjs} +177 -73
  24. package/dist/chunk-SP3ZSAOU.cjs.map +1 -0
  25. package/dist/cli/index.cjs +1 -1
  26. package/dist/cli/index.js +1 -1
  27. package/dist/index.cjs +22 -9
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +24 -3
  30. package/dist/index.d.ts +24 -3
  31. package/dist/index.js +17 -4
  32. package/dist/index.js.map +1 -1
  33. package/dist/process-BLCPNJQO.cjs +7 -0
  34. package/dist/{process-REDRQRT4.cjs.map → process-BLCPNJQO.cjs.map} +1 -1
  35. package/dist/process-XRLDLUWW.js +7 -0
  36. package/dist/{types-DEtt_e1a.d.cts → types-75ngdNZa.d.cts} +5 -1
  37. package/dist/{types-DEtt_e1a.d.ts → types-75ngdNZa.d.ts} +5 -1
  38. package/package.json +1 -1
  39. package/dist/chunk-ENRQYMG7.js.map +0 -1
  40. package/dist/chunk-HRA5O4XV.js.map +0 -1
  41. package/dist/chunk-WMZ2V72R.cjs.map +0 -1
  42. package/dist/chunk-XPYCZ2EO.cjs.map +0 -1
  43. package/dist/process-BDNNMA6J.js +0 -7
  44. package/dist/process-REDRQRT4.cjs +0 -7
  45. /package/dist/{process-BDNNMA6J.js.map → process-XRLDLUWW.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkWMZ2V72Rcjs = require('../../chunk-WMZ2V72R.cjs');
4
- require('../../chunk-XPYCZ2EO.cjs');
3
+ var _chunk2WP6WC4Icjs = require('../../chunk-2WP6WC4I.cjs');
4
+ require('../../chunk-SP3ZSAOU.cjs');
5
5
 
6
6
  // src/adapters/astro/index.ts
7
7
  function vazaContent(config) {
@@ -9,13 +9,13 @@ function vazaContent(config) {
9
9
  name: "vaza-content",
10
10
  hooks: {
11
11
  "astro:build:start": async () => {
12
- await _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, config, "public");
12
+ await _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "public");
13
13
  }
14
14
  }
15
15
  };
16
16
  }
17
17
  async function buildVazaContent(config) {
18
- return _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, config, "public");
18
+ return _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "public");
19
19
  }
20
20
 
21
21
 
@@ -1,4 +1,4 @@
1
- import { V as VazaConfig, a as VazaOutput } from '../../types-DEtt_e1a.cjs';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-75ngdNZa.cjs';
2
2
 
3
3
  /**
4
4
  * Astro adapter -- integration that hooks into build lifecycle.
@@ -1,4 +1,4 @@
1
- import { V as VazaConfig, a as VazaOutput } from '../../types-DEtt_e1a.js';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-75ngdNZa.js';
2
2
 
3
3
  /**
4
4
  * Astro adapter -- integration that hooks into build lifecycle.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  processAndWriteOutputs
3
- } from "../../chunk-HRA5O4XV.js";
4
- import "../../chunk-ENRQYMG7.js";
3
+ } from "../../chunk-HGTGVVB5.js";
4
+ import "../../chunk-GEINM3H6.js";
5
5
 
6
6
  // src/adapters/astro/index.ts
7
7
  function vazaContent(config) {
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkWMZ2V72Rcjs = require('../../chunk-WMZ2V72R.cjs');
3
+ var _chunk2WP6WC4Icjs = require('../../chunk-2WP6WC4I.cjs');
4
4
 
5
5
 
6
- var _chunkXPYCZ2EOcjs = require('../../chunk-XPYCZ2EO.cjs');
6
+ var _chunkSP3ZSAOUcjs = require('../../chunk-SP3ZSAOU.cjs');
7
7
 
8
8
  // src/adapters/next/index.ts
9
9
  var processingPromise = null;
@@ -13,9 +13,9 @@ function withVazaContent(nextConfig, vazaConfig) {
13
13
  ...nextConfig,
14
14
  webpack(config, options) {
15
15
  if (options.isServer && vazaConfig && !processingPromise) {
16
- processingPromise = _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, vazaConfig, "public");
16
+ processingPromise = _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, vazaConfig, "public");
17
17
  processingPromise.catch((err) => {
18
- _chunkXPYCZ2EOcjs.logger.error("Build error:", err);
18
+ _chunkSP3ZSAOUcjs.logger.error("Build error:", err);
19
19
  process.exit(1);
20
20
  });
21
21
  }
@@ -27,7 +27,7 @@ function withVazaContent(nextConfig, vazaConfig) {
27
27
  };
28
28
  }
29
29
  async function buildVazaContent(config) {
30
- return _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, config, "public");
30
+ return _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "public");
31
31
  }
32
32
 
33
33
 
@@ -1,4 +1,4 @@
1
- import { V as VazaConfig, a as VazaOutput } from '../../types-DEtt_e1a.cjs';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-75ngdNZa.cjs';
2
2
 
3
3
  /**
4
4
  * Next.js adapter -- wraps next.config and hooks into the build.
@@ -1,4 +1,4 @@
1
- import { V as VazaConfig, a as VazaOutput } from '../../types-DEtt_e1a.js';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-75ngdNZa.js';
2
2
 
3
3
  /**
4
4
  * Next.js adapter -- wraps next.config and hooks into the build.
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  processAndWriteOutputs
3
- } from "../../chunk-HRA5O4XV.js";
3
+ } from "../../chunk-HGTGVVB5.js";
4
4
  import {
5
5
  logger
6
- } from "../../chunk-ENRQYMG7.js";
6
+ } from "../../chunk-GEINM3H6.js";
7
7
 
8
8
  // src/adapters/next/index.ts
9
9
  var processingPromise = null;
@@ -1,22 +1,22 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkWMZ2V72Rcjs = require('../../chunk-WMZ2V72R.cjs');
4
- require('../../chunk-XPYCZ2EO.cjs');
3
+ var _chunk2WP6WC4Icjs = require('../../chunk-2WP6WC4I.cjs');
4
+ require('../../chunk-SP3ZSAOU.cjs');
5
5
 
6
6
  // src/adapters/nuxt/index.ts
7
7
  function defineVazaContentModule(config) {
8
8
  return async (_inlineOptions, nuxt) => {
9
9
  if (_optionalChain([nuxt, 'optionalAccess', _ => _.hook])) {
10
10
  nuxt.hook("build:before", async () => {
11
- await _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, config, "public");
11
+ await _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "public");
12
12
  });
13
13
  } else {
14
- await _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, config, "public");
14
+ await _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "public");
15
15
  }
16
16
  };
17
17
  }
18
18
  async function buildVazaContent(config) {
19
- return _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, config, "public");
19
+ return _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "public");
20
20
  }
21
21
 
22
22
 
@@ -1,4 +1,4 @@
1
- import { V as VazaConfig, a as VazaOutput } from '../../types-DEtt_e1a.cjs';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-75ngdNZa.cjs';
2
2
 
3
3
  /**
4
4
  * Nuxt adapter -- module that hooks into the Nuxt build.
@@ -1,4 +1,4 @@
1
- import { V as VazaConfig, a as VazaOutput } from '../../types-DEtt_e1a.js';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-75ngdNZa.js';
2
2
 
3
3
  /**
4
4
  * Nuxt adapter -- module that hooks into the Nuxt build.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  processAndWriteOutputs
3
- } from "../../chunk-HRA5O4XV.js";
4
- import "../../chunk-ENRQYMG7.js";
3
+ } from "../../chunk-HGTGVVB5.js";
4
+ import "../../chunk-GEINM3H6.js";
5
5
 
6
6
  // src/adapters/nuxt/index.ts
7
7
  function defineVazaContentModule(config) {
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkWMZ2V72Rcjs = require('../../chunk-WMZ2V72R.cjs');
4
- require('../../chunk-XPYCZ2EO.cjs');
3
+ var _chunk2WP6WC4Icjs = require('../../chunk-2WP6WC4I.cjs');
4
+ require('../../chunk-SP3ZSAOU.cjs');
5
5
 
6
6
  // src/adapters/sveltekit/index.ts
7
7
  function vazaContent(config) {
@@ -11,12 +11,12 @@ function vazaContent(config) {
11
11
  async buildStart() {
12
12
  if (hasRun) return;
13
13
  hasRun = true;
14
- await _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, config, "static");
14
+ await _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "static");
15
15
  }
16
16
  };
17
17
  }
18
18
  async function buildVazaContent(config) {
19
- return _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, config, "static");
19
+ return _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "static");
20
20
  }
21
21
 
22
22
 
@@ -1,4 +1,4 @@
1
- import { V as VazaConfig, a as VazaOutput } from '../../types-DEtt_e1a.cjs';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-75ngdNZa.cjs';
2
2
 
3
3
  /**
4
4
  * SvelteKit adapter -- Vite plugin that hooks into the build.
@@ -1,4 +1,4 @@
1
- import { V as VazaConfig, a as VazaOutput } from '../../types-DEtt_e1a.js';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-75ngdNZa.js';
2
2
 
3
3
  /**
4
4
  * SvelteKit adapter -- Vite plugin that hooks into the build.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  processAndWriteOutputs
3
- } from "../../chunk-HRA5O4XV.js";
4
- import "../../chunk-ENRQYMG7.js";
3
+ } from "../../chunk-HGTGVVB5.js";
4
+ import "../../chunk-GEINM3H6.js";
5
5
 
6
6
  // src/adapters/sveltekit/index.ts
7
7
  function vazaContent(config) {
@@ -3,32 +3,57 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkXPYCZ2EOcjs = require('./chunk-XPYCZ2EO.cjs');
6
+
7
+
8
+ var _chunkSP3ZSAOUcjs = require('./chunk-SP3ZSAOU.cjs');
7
9
 
8
10
  // src/adapters/shared.ts
9
11
  var _fs = require('fs');
10
12
  var _path = require('path');
11
13
  async function processAndWriteOutputs(config, publicDir) {
12
- const output = await _chunkXPYCZ2EOcjs.processCollections.call(void 0, config);
14
+ const output = await _chunkSP3ZSAOUcjs.processCollections.call(void 0, config);
13
15
  const outDir = ".vaza-content";
16
+ const siteUrl = config.site.url.replace(/\/$/, "");
14
17
  ensureDir(outDir);
15
18
  ensureDir(publicDir);
16
19
  if (_optionalChain([config, 'access', _ => _.sitemap, 'optionalAccess', _2 => _2.enabled]) !== false) {
17
20
  writeJson(_path.join.call(void 0, outDir, "sitemap-data.json"), output.sitemap);
18
- const xml = _chunkXPYCZ2EOcjs.renderSitemapXml.call(void 0, output.sitemap, output.hreflang);
19
- _fs.writeFileSync.call(void 0, _path.join.call(void 0, publicDir, "sitemap.xml"), xml, "utf-8");
21
+ if (_optionalChain([config, 'access', _3 => _3.sitemap, 'optionalAccess', _4 => _4.splitByCollection])) {
22
+ const groups = _chunkSP3ZSAOUcjs.splitSitemapByCollection.call(void 0, output.sitemap, output.entries);
23
+ const sitemapDir = _path.join.call(void 0, publicDir, "sitemap");
24
+ ensureDir(sitemapDir);
25
+ const indexEntries = [];
26
+ for (const [collection, entries] of groups) {
27
+ const filename = `${collection}.xml`;
28
+ const xml = _chunkSP3ZSAOUcjs.renderSitemapXml.call(void 0, entries, output.hreflang);
29
+ _fs.writeFileSync.call(void 0, _path.join.call(void 0, sitemapDir, filename), xml, "utf-8");
30
+ const lastmod = entries.reduce((latest, e) => {
31
+ if (!e.lastmod) return latest;
32
+ return !latest || e.lastmod > latest ? e.lastmod : latest;
33
+ }, "");
34
+ indexEntries.push({
35
+ loc: `${siteUrl}/sitemap/${filename}`,
36
+ ...lastmod && { lastmod }
37
+ });
38
+ }
39
+ const indexXml = _chunkSP3ZSAOUcjs.renderSitemapIndex.call(void 0, indexEntries);
40
+ _fs.writeFileSync.call(void 0, _path.join.call(void 0, publicDir, "sitemap.xml"), indexXml, "utf-8");
41
+ } else {
42
+ const xml = _chunkSP3ZSAOUcjs.renderSitemapXml.call(void 0, output.sitemap, output.hreflang);
43
+ _fs.writeFileSync.call(void 0, _path.join.call(void 0, publicDir, "sitemap.xml"), xml, "utf-8");
44
+ }
20
45
  }
21
- if (_optionalChain([config, 'access', _3 => _3.rss, 'optionalAccess', _4 => _4.enabled]) !== false) {
22
- const xml = _chunkXPYCZ2EOcjs.renderRssXml.call(void 0, output.rss, config);
23
- const rssPath = _nullishCoalesce(_optionalChain([config, 'access', _5 => _5.rss, 'optionalAccess', _6 => _6.path]), () => ( "/rss.xml"));
46
+ if (_optionalChain([config, 'access', _5 => _5.rss, 'optionalAccess', _6 => _6.enabled]) !== false) {
47
+ const xml = _chunkSP3ZSAOUcjs.renderRssXml.call(void 0, output.rss, config);
48
+ const rssPath = _nullishCoalesce(_optionalChain([config, 'access', _7 => _7.rss, 'optionalAccess', _8 => _8.path]), () => ( "/rss.xml"));
24
49
  const rssFile = _path.join.call(void 0, publicDir, rssPath.replace(/^\//, ""));
25
50
  ensureDir(_path.dirname.call(void 0, rssFile));
26
51
  _fs.writeFileSync.call(void 0, rssFile, xml, "utf-8");
27
52
  }
28
- if (_optionalChain([config, 'access', _7 => _7.robots, 'optionalAccess', _8 => _8.enabled]) !== false && output.robots) {
53
+ if (_optionalChain([config, 'access', _9 => _9.robots, 'optionalAccess', _10 => _10.enabled]) !== false && output.robots) {
29
54
  _fs.writeFileSync.call(void 0, _path.join.call(void 0, publicDir, "robots.txt"), output.robots, "utf-8");
30
55
  }
31
- if (_optionalChain([config, 'access', _9 => _9.jsonLd, 'optionalAccess', _10 => _10.enabled]) !== false) {
56
+ if (_optionalChain([config, 'access', _11 => _11.jsonLd, 'optionalAccess', _12 => _12.enabled]) !== false) {
32
57
  const jsonLdDir = _path.join.call(void 0, outDir, "json-ld");
33
58
  ensureDir(jsonLdDir);
34
59
  for (const [slug, schemas] of Object.entries(output.jsonLd)) {
@@ -38,24 +63,24 @@ async function processAndWriteOutputs(config, publicDir) {
38
63
  writeJson(_path.join.call(void 0, jsonLdDir, "_website.json"), output.websiteSchema);
39
64
  }
40
65
  }
41
- if (_optionalChain([config, 'access', _11 => _11.metaTags, 'optionalAccess', _12 => _12.enabled]) !== false) {
66
+ if (_optionalChain([config, 'access', _13 => _13.metaTags, 'optionalAccess', _14 => _14.enabled]) !== false) {
42
67
  const metaDir = _path.join.call(void 0, outDir, "meta-tags");
43
68
  ensureDir(metaDir);
44
69
  for (const [slug, tags] of Object.entries(output.metaTags)) {
45
70
  writeJson(_path.join.call(void 0, metaDir, `${slug}.json`), tags);
46
71
  }
47
72
  }
48
- if (_optionalChain([config, 'access', _13 => _13.hreflang, 'optionalAccess', _14 => _14.enabled]) !== false && Object.keys(output.hreflang).length > 0) {
73
+ if (_optionalChain([config, 'access', _15 => _15.hreflang, 'optionalAccess', _16 => _16.enabled]) !== false && Object.keys(output.hreflang).length > 0) {
49
74
  const hreflangDir = _path.join.call(void 0, outDir, "hreflang");
50
75
  ensureDir(hreflangDir);
51
76
  for (const [slug, links] of Object.entries(output.hreflang)) {
52
77
  writeJson(_path.join.call(void 0, hreflangDir, `${slug}.json`), links);
53
78
  }
54
79
  }
55
- if (_optionalChain([config, 'access', _15 => _15.taxonomy, 'optionalAccess', _16 => _16.enabled]) !== false) {
80
+ if (_optionalChain([config, 'access', _17 => _17.taxonomy, 'optionalAccess', _18 => _18.enabled]) !== false) {
56
81
  writeJson(_path.join.call(void 0, outDir, "taxonomy.json"), output.taxonomy);
57
82
  }
58
- if (_optionalChain([config, 'access', _17 => _17.redirects, 'optionalAccess', _18 => _18.enabled]) !== false) {
83
+ if (_optionalChain([config, 'access', _19 => _19.redirects, 'optionalAccess', _20 => _20.enabled]) !== false) {
59
84
  writeJson(_path.join.call(void 0, outDir, "redirects.json"), output.redirects);
60
85
  }
61
86
  if (Object.keys(output.linkingSuggestions).length > 0) {
@@ -67,8 +92,8 @@ async function processAndWriteOutputs(config, publicDir) {
67
92
  writeJson(_path.join.call(void 0, outDir, "integrity-report.json"), output.integrity);
68
93
  const slugManifest = output.entries.map((e) => e.slug);
69
94
  writeJson(_path.join.call(void 0, outDir, "slugs.json"), slugManifest);
70
- _chunkXPYCZ2EOcjs.logger.info(`Generated ${output.entries.length} entries`);
71
- _chunkXPYCZ2EOcjs.logger.info(`Outputs written to ${outDir}/ and ${publicDir}/`);
95
+ _chunkSP3ZSAOUcjs.logger.info(`Generated ${output.entries.length} entries`);
96
+ _chunkSP3ZSAOUcjs.logger.info(`Outputs written to ${outDir}/ and ${publicDir}/`);
72
97
  return output;
73
98
  }
74
99
  function ensureDir(dir) {
@@ -84,4 +109,4 @@ function writeJson(path, data) {
84
109
 
85
110
 
86
111
  exports.processAndWriteOutputs = processAndWriteOutputs;
87
- //# sourceMappingURL=chunk-WMZ2V72R.cjs.map
112
+ //# sourceMappingURL=chunk-2WP6WC4I.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/mehdi/vaza-content/dist/chunk-2WP6WC4I.cjs","../src/adapters/shared.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACTA,wBAAqD;AACrD,4BAA8B;AAgB9B,MAAA,SAAsB,sBAAA,CACpB,MAAA,EACA,SAAA,EACqB;AACrB,EAAA,MAAM,OAAA,EAAS,MAAM,kDAAA,MAAyB,CAAA;AAC9C,EAAA,MAAM,OAAA,EAAS,eAAA;AACf,EAAA,MAAM,QAAA,EAAU,MAAA,CAAO,IAAA,CAAK,GAAA,CAAI,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAA;AAEjD,EAAA,SAAA,CAAU,MAAM,CAAA;AAChB,EAAA,SAAA,CAAU,SAAS,CAAA;AAGnB,EAAA,GAAA,iBAAI,MAAA,mBAAO,OAAA,6BAAS,UAAA,IAAY,KAAA,EAAO;AACrC,IAAA,SAAA,CAAU,wBAAA,MAAK,EAAQ,mBAAmB,CAAA,EAAG,MAAA,CAAO,OAAO,CAAA;AAE3D,IAAA,GAAA,iBAAI,MAAA,qBAAO,OAAA,6BAAS,mBAAA,EAAmB;AAErC,MAAA,MAAM,OAAA,EAAS,wDAAA,MAAyB,CAAO,OAAA,EAAS,MAAA,CAAO,OAAO,CAAA;AACtE,MAAA,MAAM,WAAA,EAAa,wBAAA,SAAK,EAAW,SAAS,CAAA;AAC5C,MAAA,SAAA,CAAU,UAAU,CAAA;AAEpB,MAAA,MAAM,aAAA,EAAoD,CAAC,CAAA;AAE3D,MAAA,IAAA,CAAA,MAAW,CAAC,UAAA,EAAY,OAAO,EAAA,GAAK,MAAA,EAAQ;AAC1C,QAAA,MAAM,SAAA,EAAW,CAAA,EAAA;AACL,QAAA;AACE,QAAA;AAGE,QAAA;AACE,UAAA;AACR,UAAA;AACK,QAAA;AAEG,QAAA;AACD,UAAA;AACE,UAAA;AAClB,QAAA;AACH,MAAA;AAEiB,MAAA;AACE,MAAA;AACd,IAAA;AAEO,MAAA;AACO,MAAA;AACrB,IAAA;AACF,EAAA;AAGgB,EAAA;AACF,IAAA;AACI,IAAA;AACK,IAAA;AACH,IAAA;AACJ,IAAA;AAChB,EAAA;AAGmB,EAAA;AACE,IAAA;AACrB,EAAA;AAGmB,EAAA;AACC,IAAA;AACC,IAAA;AACD,IAAA;AACD,MAAA;AACjB,IAAA;AAEgB,IAAA;AACC,MAAA;AACjB,IAAA;AACF,EAAA;AAGqB,EAAA;AACE,IAAA;AACJ,IAAA;AACK,IAAA;AACL,MAAA;AACjB,IAAA;AACF,EAAA;AAImB,EAAA;AAGG,IAAA;AACC,IAAA;AACH,IAAA;AACD,MAAA;AACjB,IAAA;AACF,EAAA;AAGqB,EAAA;AACJ,IAAA;AACjB,EAAA;AAGsB,EAAA;AACL,IAAA;AACjB,EAAA;AAGuB,EAAA;AACrB,IAAA;AACe,MAAA;AACN,MAAA;AACT,IAAA;AACF,EAAA;AAGuB,EAAA;AAGF,EAAA;AACE,EAAA;AAEX,EAAA;AACA,EAAA;AAEL,EAAA;AACT;AAEsC;AACd,EAAA;AACH,IAAA;AACnB,EAAA;AACF;AAEiC;AACR,EAAA;AACH,EAAA;AACtB;AD/C0B;AACA;AACA;AACA","file":"/Users/mehdi/vaza-content/dist/chunk-2WP6WC4I.cjs","sourcesContent":[null,"import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { renderRssXml } from \"../generate/rss.js\";\nimport {\n renderSitemapIndex,\n renderSitemapXml,\n splitSitemapByCollection,\n} from \"../generate/sitemap.js\";\nimport { logger } from \"../logger.js\";\nimport { processCollections } from \"../process.js\";\nimport type { VazaConfig, VazaOutput } from \"../types.js\";\n\n/**\n * Shared adapter logic: process collections and write all output files.\n * @param config - vaza-content config\n * @param publicDir - framework-specific public directory (\"public\" or \"static\")\n */\nexport async function processAndWriteOutputs(\n config: VazaConfig,\n publicDir: string,\n): Promise<VazaOutput> {\n const output = await processCollections(config);\n const outDir = \".vaza-content\";\n const siteUrl = config.site.url.replace(/\\/$/, \"\");\n\n ensureDir(outDir);\n ensureDir(publicDir);\n\n // Write sitemap\n if (config.sitemap?.enabled !== false) {\n writeJson(join(outDir, \"sitemap-data.json\"), output.sitemap);\n\n if (config.sitemap?.splitByCollection) {\n // Multi-file sitemap with index\n const groups = splitSitemapByCollection(output.sitemap, output.entries);\n const sitemapDir = join(publicDir, \"sitemap\");\n ensureDir(sitemapDir);\n\n const indexEntries: { loc: string; lastmod?: string }[] = [];\n\n for (const [collection, entries] of groups) {\n const filename = `${collection}.xml`;\n const xml = renderSitemapXml(entries, output.hreflang);\n writeFileSync(join(sitemapDir, filename), xml, \"utf-8\");\n\n // Find most recent lastmod for the index\n const lastmod = entries.reduce((latest, e) => {\n if (!e.lastmod) return latest;\n return !latest || e.lastmod > latest ? e.lastmod : latest;\n }, \"\" as string);\n\n indexEntries.push({\n loc: `${siteUrl}/sitemap/${filename}`,\n ...(lastmod && { lastmod }),\n });\n }\n\n const indexXml = renderSitemapIndex(indexEntries);\n writeFileSync(join(publicDir, \"sitemap.xml\"), indexXml, \"utf-8\");\n } else {\n // Single sitemap file\n const xml = renderSitemapXml(output.sitemap, output.hreflang);\n writeFileSync(join(publicDir, \"sitemap.xml\"), xml, \"utf-8\");\n }\n }\n\n // Write RSS\n if (config.rss?.enabled !== false) {\n const xml = renderRssXml(output.rss, config);\n const rssPath = config.rss?.path ?? \"/rss.xml\";\n const rssFile = join(publicDir, rssPath.replace(/^\\//, \"\"));\n ensureDir(dirname(rssFile));\n writeFileSync(rssFile, xml, \"utf-8\");\n }\n\n // Write robots.txt\n if (config.robots?.enabled !== false && output.robots) {\n writeFileSync(join(publicDir, \"robots.txt\"), output.robots, \"utf-8\");\n }\n\n // Write JSON-LD per slug\n if (config.jsonLd?.enabled !== false) {\n const jsonLdDir = join(outDir, \"json-ld\");\n ensureDir(jsonLdDir);\n for (const [slug, schemas] of Object.entries(output.jsonLd)) {\n writeJson(join(jsonLdDir, `${slug}.json`), schemas);\n }\n // Write WebSite schema\n if (Object.keys(output.websiteSchema).length > 0) {\n writeJson(join(jsonLdDir, \"_website.json\"), output.websiteSchema);\n }\n }\n\n // Write meta tags per slug\n if (config.metaTags?.enabled !== false) {\n const metaDir = join(outDir, \"meta-tags\");\n ensureDir(metaDir);\n for (const [slug, tags] of Object.entries(output.metaTags)) {\n writeJson(join(metaDir, `${slug}.json`), tags);\n }\n }\n\n // Write hreflang per slug\n if (\n config.hreflang?.enabled !== false &&\n Object.keys(output.hreflang).length > 0\n ) {\n const hreflangDir = join(outDir, \"hreflang\");\n ensureDir(hreflangDir);\n for (const [slug, links] of Object.entries(output.hreflang)) {\n writeJson(join(hreflangDir, `${slug}.json`), links);\n }\n }\n\n // Write taxonomy data\n if (config.taxonomy?.enabled !== false) {\n writeJson(join(outDir, \"taxonomy.json\"), output.taxonomy);\n }\n\n // Write redirects\n if (config.redirects?.enabled !== false) {\n writeJson(join(outDir, \"redirects.json\"), output.redirects);\n }\n\n // Write linking suggestions\n if (Object.keys(output.linkingSuggestions).length > 0) {\n writeJson(\n join(outDir, \"linking-suggestions.json\"),\n output.linkingSuggestions,\n );\n }\n\n // Write integrity report\n writeJson(join(outDir, \"integrity-report.json\"), output.integrity);\n\n // Write slug manifest for redirect detection\n const slugManifest = output.entries.map((e) => e.slug);\n writeJson(join(outDir, \"slugs.json\"), slugManifest);\n\n logger.info(`Generated ${output.entries.length} entries`);\n logger.info(`Outputs written to ${outDir}/ and ${publicDir}/`);\n\n return output;\n}\n\nfunction ensureDir(dir: string): void {\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n}\n\nfunction writeJson(path: string, data: unknown): void {\n ensureDir(dirname(path));\n writeFileSync(path, JSON.stringify(data, null, 2), \"utf-8\");\n}\n"]}
@@ -1,13 +1,53 @@
1
+ // src/logger.ts
2
+ var LEVELS = {
3
+ silent: 0,
4
+ error: 1,
5
+ warn: 2,
6
+ info: 3,
7
+ debug: 4
8
+ };
9
+ var currentLevel = "info";
10
+ function setLogLevel(level) {
11
+ currentLevel = level;
12
+ }
13
+ function shouldLog(level) {
14
+ return LEVELS[level] <= LEVELS[currentLevel];
15
+ }
16
+ var logger = {
17
+ error(...args) {
18
+ if (shouldLog("error")) console.error("[vaza-content]", ...args);
19
+ },
20
+ warn(...args) {
21
+ if (shouldLog("warn")) console.warn("[vaza-content]", ...args);
22
+ },
23
+ info(...args) {
24
+ if (shouldLog("info")) console.log("[vaza-content]", ...args);
25
+ },
26
+ debug(...args) {
27
+ if (shouldLog("debug")) console.log("[vaza-content] [debug]", ...args);
28
+ }
29
+ };
30
+
1
31
  // src/generate/hreflang.ts
2
32
  function generateHreflang(entries, config) {
3
33
  const locales = config.hreflang?.locales;
4
34
  if (!locales || locales.length === 0) return {};
35
+ const validLocales = locales.filter((locale) => {
36
+ if (!locale.lang || !locale.basePath) {
37
+ logger.warn(
38
+ `Skipping invalid hreflang locale: missing ${!locale.lang ? "lang" : "basePath"}`
39
+ );
40
+ return false;
41
+ }
42
+ return true;
43
+ });
44
+ if (validLocales.length === 0) return {};
5
45
  const siteUrl = config.site.url.replace(/\/$/, "");
6
46
  const result = {};
7
47
  for (const entry of entries) {
8
48
  if (entry.noindex) continue;
9
49
  const links = [];
10
- for (const locale of locales) {
50
+ for (const locale of validLocales) {
11
51
  const basePath = locale.basePath.replace(/\/$/, "");
12
52
  links.push({
13
53
  lang: locale.lang,
@@ -63,6 +103,13 @@ function generateArticleSchema(entry, site) {
63
103
  if (entry.wordCount) {
64
104
  schema.wordCount = entry.wordCount;
65
105
  }
106
+ if (entry.readingTime) {
107
+ schema.timeRequired = `PT${entry.readingTime}M`;
108
+ }
109
+ schema.speakable = {
110
+ "@type": "SpeakableSpecification",
111
+ cssSelector: ["headline", "description"]
112
+ };
66
113
  return schema;
67
114
  }
68
115
 
@@ -545,36 +592,6 @@ var OG_IMAGE_WIDTH = 1200;
545
592
  var OG_IMAGE_HEIGHT = 630;
546
593
  var OG_IMAGE_CONCURRENCY = 5;
547
594
 
548
- // src/logger.ts
549
- var LEVELS = {
550
- silent: 0,
551
- error: 1,
552
- warn: 2,
553
- info: 3,
554
- debug: 4
555
- };
556
- var currentLevel = "info";
557
- function setLogLevel(level) {
558
- currentLevel = level;
559
- }
560
- function shouldLog(level) {
561
- return LEVELS[level] <= LEVELS[currentLevel];
562
- }
563
- var logger = {
564
- error(...args) {
565
- if (shouldLog("error")) console.error("[vaza-content]", ...args);
566
- },
567
- warn(...args) {
568
- if (shouldLog("warn")) console.warn("[vaza-content]", ...args);
569
- },
570
- info(...args) {
571
- if (shouldLog("info")) console.log("[vaza-content]", ...args);
572
- },
573
- debug(...args) {
574
- if (shouldLog("debug")) console.log("[vaza-content] [debug]", ...args);
575
- }
576
- };
577
-
578
595
  // src/utils/concurrency.ts
579
596
  async function pMap(items, fn, concurrency) {
580
597
  const results = new Array(items.length);
@@ -701,8 +718,13 @@ async function loadFont(config) {
701
718
  logger.debug("Inter font cached");
702
719
  return arrayBuffer;
703
720
  } catch (err) {
704
- logger.warn("Could not fetch Inter font, using empty fallback:", err);
705
- return new ArrayBuffer(0);
721
+ logger.error(
722
+ "Could not load font for OG images. Provide a fontPath in ogImages config or ensure network access to Google Fonts.",
723
+ err
724
+ );
725
+ throw new Error(
726
+ "[vaza-content] OG image generation requires a font. Set ogImages.fontPath or ensure network access."
727
+ );
706
728
  }
707
729
  }
708
730
  async function loadTemplate(template) {
@@ -895,6 +917,31 @@ function extractSlug(filePath) {
895
917
  }
896
918
 
897
919
  // src/generate/robots.ts
920
+ var AI_SEARCH_BOTS = [
921
+ "ChatGPT-User",
922
+ "OAI-SearchBot",
923
+ "GPTBot",
924
+ "PerplexityBot",
925
+ "YouBot",
926
+ "Amazonbot",
927
+ "PhindBot",
928
+ "Claude",
929
+ "anthropic-ai",
930
+ "google-extended",
931
+ "CCBot"
932
+ ];
933
+ var AI_TRAINING_BOTS = [
934
+ "Meta-ExternalAgent",
935
+ "Bytespider",
936
+ "Applebot-Extended",
937
+ "cohere-ai",
938
+ "Diffbot",
939
+ "DeepSeekBot",
940
+ "FacebookBot",
941
+ "PetalBot",
942
+ "Omgilibot",
943
+ "img2dataset"
944
+ ];
898
945
  function generateRobots(config) {
899
946
  const siteUrl = config.site.url.replace(/\/$/, "");
900
947
  const rules = config.robots?.rules ?? [
@@ -915,6 +962,21 @@ function generateRobots(config) {
915
962
  }
916
963
  lines.push("");
917
964
  }
965
+ const aiPolicy = config.robots?.aiPolicy ?? "allow-search";
966
+ if (aiPolicy === "allow-all") {
967
+ } else if (aiPolicy === "allow-search") {
968
+ for (const bot of AI_TRAINING_BOTS) {
969
+ lines.push(`User-agent: ${bot}`);
970
+ lines.push("Disallow: /");
971
+ lines.push("");
972
+ }
973
+ } else if (aiPolicy === "block-all") {
974
+ for (const bot of [...AI_SEARCH_BOTS, ...AI_TRAINING_BOTS]) {
975
+ lines.push(`User-agent: ${bot}`);
976
+ lines.push("Disallow: /");
977
+ lines.push("");
978
+ }
979
+ }
918
980
  if (config.sitemap?.enabled !== false) {
919
981
  lines.push(`Sitemap: ${siteUrl}/sitemap.xml`);
920
982
  }
@@ -1097,9 +1159,8 @@ function renderSitemapXml(entries, hreflang) {
1097
1159
  children.push(el("image:image", imgChildren));
1098
1160
  }
1099
1161
  }
1100
- if (hasHreflang) {
1101
- const slug = extractSlugFromUrl(entry.loc);
1102
- const links = slug && hreflang ? hreflang[slug] : void 0;
1162
+ if (hasHreflang && hreflang) {
1163
+ const links = findHreflangLinks(entry.loc, hreflang);
1103
1164
  if (links) {
1104
1165
  for (const link of links) {
1105
1166
  children.push({
@@ -1118,9 +1179,44 @@ function renderSitemapXml(entries, hreflang) {
1118
1179
  });
1119
1180
  return renderXmlDocument(el("urlset", attrs, urlNodes));
1120
1181
  }
1121
- function extractSlugFromUrl(url) {
1122
- const parts = url.split("/").filter(Boolean);
1123
- return parts[parts.length - 1];
1182
+ function findHreflangLinks(loc, hreflang) {
1183
+ const pathPart = loc.replace(/^https?:\/\/[^/]+/, "");
1184
+ const segments = pathPart.split("/").filter(Boolean);
1185
+ for (let i = segments.length - 1; i >= 0; i--) {
1186
+ const candidate = segments.slice(i).join("/");
1187
+ if (hreflang[candidate]) {
1188
+ return hreflang[candidate];
1189
+ }
1190
+ }
1191
+ return void 0;
1192
+ }
1193
+ function renderSitemapIndex(sitemaps) {
1194
+ const root = el(
1195
+ "sitemapindex",
1196
+ { xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9" },
1197
+ sitemaps.map((s) => {
1198
+ const children = [el("loc", [s.loc])];
1199
+ if (s.lastmod) children.push(el("lastmod", [s.lastmod]));
1200
+ return el("sitemap", children);
1201
+ })
1202
+ );
1203
+ return renderXmlDocument(root);
1204
+ }
1205
+ function splitSitemapByCollection(entries, allEntries) {
1206
+ const groups = /* @__PURE__ */ new Map();
1207
+ const slugToCollection = /* @__PURE__ */ new Map();
1208
+ for (const entry of allEntries) {
1209
+ slugToCollection.set(entry.slug, entry._collection ?? "default");
1210
+ }
1211
+ for (const sitemapEntry of entries) {
1212
+ const parts = sitemapEntry.loc.split("/").filter(Boolean);
1213
+ const slug = parts[parts.length - 1];
1214
+ const collection = slugToCollection.get(slug ?? "") ?? "default";
1215
+ const group = groups.get(collection) ?? [];
1216
+ group.push(sitemapEntry);
1217
+ groups.set(collection, group);
1218
+ }
1219
+ return groups;
1124
1220
  }
1125
1221
 
1126
1222
  // src/generate/taxonomy.ts
@@ -1131,6 +1227,7 @@ function generateTaxonomy(entries, _config) {
1131
1227
  if (entry.tags) {
1132
1228
  for (const tag of entry.tags) {
1133
1229
  const normalized = tag.toLowerCase().trim();
1230
+ if (!normalized) continue;
1134
1231
  if (!tags[normalized]) {
1135
1232
  tags[normalized] = [];
1136
1233
  }
@@ -1139,10 +1236,12 @@ function generateTaxonomy(entries, _config) {
1139
1236
  }
1140
1237
  if (entry.category) {
1141
1238
  const normalized = entry.category.toLowerCase().trim();
1142
- if (!categories[normalized]) {
1143
- categories[normalized] = [];
1239
+ if (normalized) {
1240
+ if (!categories[normalized]) {
1241
+ categories[normalized] = [];
1242
+ }
1243
+ categories[normalized].push(entry.slug);
1144
1244
  }
1145
- categories[normalized].push(entry.slug);
1146
1245
  }
1147
1246
  }
1148
1247
  return { tags, categories };
@@ -1442,6 +1541,7 @@ async function generateBlurPlaceholder(imagePath) {
1442
1541
  const buffer = await sharp(imagePath).resize(8, 8, { fit: "inside" }).blur().png().toBuffer();
1443
1542
  return `data:image/png;base64,${buffer.toString("base64")}`;
1444
1543
  } catch {
1544
+ logger.debug(`Could not generate blur placeholder: "${imagePath}"`);
1445
1545
  return void 0;
1446
1546
  }
1447
1547
  }
@@ -1476,8 +1576,10 @@ async function getImageDimensions(imagePath) {
1476
1576
  if (metadata.width && metadata.height) {
1477
1577
  return { width: metadata.width, height: metadata.height };
1478
1578
  }
1579
+ logger.debug(`Image dimensions incomplete for "${imagePath}"`);
1479
1580
  return void 0;
1480
1581
  } catch {
1582
+ logger.debug(`Could not read image dimensions: "${imagePath}"`);
1481
1583
  return void 0;
1482
1584
  }
1483
1585
  }
@@ -1671,13 +1773,13 @@ export {
1671
1773
  DEFAULT_SITEMAP_PRIORITY,
1672
1774
  DEFAULT_SITEMAP_CHANGE_FREQ,
1673
1775
  generateBreadcrumbs,
1776
+ setLogLevel,
1777
+ logger,
1674
1778
  generateHreflang,
1675
1779
  generateJsonLd,
1676
1780
  generateWebSiteSchema,
1677
1781
  generateLinkingSuggestions,
1678
1782
  generateMetaTags,
1679
- setLogLevel,
1680
- logger,
1681
1783
  generateOgImages,
1682
1784
  detectRedirects,
1683
1785
  generateRobots,
@@ -1685,9 +1787,11 @@ export {
1685
1787
  renderRssXml,
1686
1788
  generateSitemap,
1687
1789
  renderSitemapXml,
1790
+ renderSitemapIndex,
1791
+ splitSitemapByCollection,
1688
1792
  generateTaxonomy,
1689
1793
  checkIntegrity,
1690
1794
  normalize2 as normalize,
1691
1795
  processCollections
1692
1796
  };
1693
- //# sourceMappingURL=chunk-ENRQYMG7.js.map
1797
+ //# sourceMappingURL=chunk-GEINM3H6.js.map