vaza-content 0.3.0 → 0.3.2

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-QJYWBJE2.cjs → chunk-DJUCNWHK.cjs} +41 -16
  18. package/dist/chunk-DJUCNWHK.cjs.map +1 -0
  19. package/dist/{chunk-UCWY7BIM.js → chunk-JKS5PF2Y.js} +192 -52
  20. package/dist/chunk-JKS5PF2Y.js.map +1 -0
  21. package/dist/{chunk-42BZQUA7.js → chunk-PI5TLKE3.js} +30 -5
  22. package/dist/chunk-PI5TLKE3.js.map +1 -0
  23. package/dist/{chunk-NHCLSSMK.cjs → chunk-XO56R4TD.cjs} +221 -81
  24. package/dist/chunk-XO56R4TD.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 +14 -8
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +24 -7
  30. package/dist/index.d.ts +24 -7
  31. package/dist/index.js +9 -3
  32. package/dist/index.js.map +1 -1
  33. package/dist/process-O5CGWUU7.js +7 -0
  34. package/dist/process-UCPFMQ6X.cjs +7 -0
  35. package/dist/{process-K3PJFLUV.cjs.map → process-UCPFMQ6X.cjs.map} +1 -1
  36. package/dist/{types-CtC0JyA4.d.cts → types-By1RQiKy.d.cts} +5 -1
  37. package/dist/{types-CtC0JyA4.d.ts → types-By1RQiKy.d.ts} +5 -1
  38. package/package.json +1 -1
  39. package/dist/chunk-42BZQUA7.js.map +0 -1
  40. package/dist/chunk-NHCLSSMK.cjs.map +0 -1
  41. package/dist/chunk-QJYWBJE2.cjs.map +0 -1
  42. package/dist/chunk-UCWY7BIM.js.map +0 -1
  43. package/dist/process-K3PJFLUV.cjs +0 -7
  44. package/dist/process-XS6U5TCT.js +0 -7
  45. /package/dist/{process-XS6U5TCT.js.map → process-O5CGWUU7.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkQJYWBJE2cjs = require('../../chunk-QJYWBJE2.cjs');
4
- require('../../chunk-NHCLSSMK.cjs');
3
+ var _chunkDJUCNWHKcjs = require('../../chunk-DJUCNWHK.cjs');
4
+ require('../../chunk-XO56R4TD.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 _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, config, "public");
12
+ await _chunkDJUCNWHKcjs.processAndWriteOutputs.call(void 0, config, "public");
13
13
  }
14
14
  }
15
15
  };
16
16
  }
17
17
  async function buildVazaContent(config) {
18
- return _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, config, "public");
18
+ return _chunkDJUCNWHKcjs.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-CtC0JyA4.cjs';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-By1RQiKy.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-CtC0JyA4.js';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-By1RQiKy.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-42BZQUA7.js";
4
- import "../../chunk-UCWY7BIM.js";
3
+ } from "../../chunk-PI5TLKE3.js";
4
+ import "../../chunk-JKS5PF2Y.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 _chunkQJYWBJE2cjs = require('../../chunk-QJYWBJE2.cjs');
3
+ var _chunkDJUCNWHKcjs = require('../../chunk-DJUCNWHK.cjs');
4
4
 
5
5
 
6
- var _chunkNHCLSSMKcjs = require('../../chunk-NHCLSSMK.cjs');
6
+ var _chunkXO56R4TDcjs = require('../../chunk-XO56R4TD.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 = _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, vazaConfig, "public");
16
+ processingPromise = _chunkDJUCNWHKcjs.processAndWriteOutputs.call(void 0, vazaConfig, "public");
17
17
  processingPromise.catch((err) => {
18
- _chunkNHCLSSMKcjs.logger.error("Build error:", err);
18
+ _chunkXO56R4TDcjs.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 _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, config, "public");
30
+ return _chunkDJUCNWHKcjs.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-CtC0JyA4.cjs';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-By1RQiKy.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-CtC0JyA4.js';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-By1RQiKy.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-42BZQUA7.js";
3
+ } from "../../chunk-PI5TLKE3.js";
4
4
  import {
5
5
  logger
6
- } from "../../chunk-UCWY7BIM.js";
6
+ } from "../../chunk-JKS5PF2Y.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 _chunkQJYWBJE2cjs = require('../../chunk-QJYWBJE2.cjs');
4
- require('../../chunk-NHCLSSMK.cjs');
3
+ var _chunkDJUCNWHKcjs = require('../../chunk-DJUCNWHK.cjs');
4
+ require('../../chunk-XO56R4TD.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 _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, config, "public");
11
+ await _chunkDJUCNWHKcjs.processAndWriteOutputs.call(void 0, config, "public");
12
12
  });
13
13
  } else {
14
- await _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, config, "public");
14
+ await _chunkDJUCNWHKcjs.processAndWriteOutputs.call(void 0, config, "public");
15
15
  }
16
16
  };
17
17
  }
18
18
  async function buildVazaContent(config) {
19
- return _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, config, "public");
19
+ return _chunkDJUCNWHKcjs.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-CtC0JyA4.cjs';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-By1RQiKy.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-CtC0JyA4.js';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-By1RQiKy.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-42BZQUA7.js";
4
- import "../../chunk-UCWY7BIM.js";
3
+ } from "../../chunk-PI5TLKE3.js";
4
+ import "../../chunk-JKS5PF2Y.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 _chunkQJYWBJE2cjs = require('../../chunk-QJYWBJE2.cjs');
4
- require('../../chunk-NHCLSSMK.cjs');
3
+ var _chunkDJUCNWHKcjs = require('../../chunk-DJUCNWHK.cjs');
4
+ require('../../chunk-XO56R4TD.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 _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, config, "static");
14
+ await _chunkDJUCNWHKcjs.processAndWriteOutputs.call(void 0, config, "static");
15
15
  }
16
16
  };
17
17
  }
18
18
  async function buildVazaContent(config) {
19
- return _chunkQJYWBJE2cjs.processAndWriteOutputs.call(void 0, config, "static");
19
+ return _chunkDJUCNWHKcjs.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-CtC0JyA4.cjs';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-By1RQiKy.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-CtC0JyA4.js';
1
+ import { V as VazaConfig, a as VazaOutput } from '../../types-By1RQiKy.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-42BZQUA7.js";
4
- import "../../chunk-UCWY7BIM.js";
3
+ } from "../../chunk-PI5TLKE3.js";
4
+ import "../../chunk-JKS5PF2Y.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 _chunkNHCLSSMKcjs = require('./chunk-NHCLSSMK.cjs');
6
+
7
+
8
+ var _chunkXO56R4TDcjs = require('./chunk-XO56R4TD.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 _chunkNHCLSSMKcjs.processCollections.call(void 0, config);
14
+ const output = await _chunkXO56R4TDcjs.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 = _chunkNHCLSSMKcjs.renderSitemapXml.call(void 0, output.sitemap);
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 = _chunkXO56R4TDcjs.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 = _chunkXO56R4TDcjs.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 = _chunkXO56R4TDcjs.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 = _chunkXO56R4TDcjs.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 = _chunkNHCLSSMKcjs.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 = _chunkXO56R4TDcjs.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
- _chunkNHCLSSMKcjs.logger.info(`Generated ${output.entries.length} entries`);
71
- _chunkNHCLSSMKcjs.logger.info(`Outputs written to ${outDir}/ and ${publicDir}/`);
95
+ _chunkXO56R4TDcjs.logger.info(`Generated ${output.entries.length} entries`);
96
+ _chunkXO56R4TDcjs.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-QJYWBJE2.cjs.map
112
+ //# sourceMappingURL=chunk-DJUCNWHK.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/mehdi/vaza-content/dist/chunk-DJUCNWHK.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-DJUCNWHK.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"]}