vaza-content 0.3.2 → 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.
- package/dist/adapters/astro/index.cjs +4 -4
- package/dist/adapters/astro/index.d.cts +1 -1
- package/dist/adapters/astro/index.d.ts +1 -1
- package/dist/adapters/astro/index.js +2 -2
- package/dist/adapters/next/index.cjs +5 -5
- package/dist/adapters/next/index.d.cts +1 -1
- package/dist/adapters/next/index.d.ts +1 -1
- package/dist/adapters/next/index.js +2 -2
- package/dist/adapters/nuxt/index.cjs +5 -5
- package/dist/adapters/nuxt/index.d.cts +1 -1
- package/dist/adapters/nuxt/index.d.ts +1 -1
- package/dist/adapters/nuxt/index.js +2 -2
- package/dist/adapters/sveltekit/index.cjs +4 -4
- package/dist/adapters/sveltekit/index.d.cts +1 -1
- package/dist/adapters/sveltekit/index.d.ts +1 -1
- package/dist/adapters/sveltekit/index.js +2 -2
- package/dist/{chunk-DJUCNWHK.cjs → chunk-2WP6WC4I.cjs} +10 -10
- package/dist/{chunk-DJUCNWHK.cjs.map → chunk-2WP6WC4I.cjs.map} +1 -1
- package/dist/{chunk-JKS5PF2Y.js → chunk-GEINM3H6.js} +72 -45
- package/dist/chunk-GEINM3H6.js.map +1 -0
- package/dist/{chunk-PI5TLKE3.js → chunk-HGTGVVB5.js} +2 -2
- package/dist/{chunk-XO56R4TD.cjs → chunk-SP3ZSAOU.cjs} +72 -45
- package/dist/chunk-SP3ZSAOU.cjs.map +1 -0
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/index.cjs +16 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/process-BLCPNJQO.cjs +7 -0
- package/dist/{process-UCPFMQ6X.cjs.map → process-BLCPNJQO.cjs.map} +1 -1
- package/dist/process-XRLDLUWW.js +7 -0
- package/dist/{types-By1RQiKy.d.ts → types-75ngdNZa.d.cts} +1 -1
- package/dist/{types-By1RQiKy.d.cts → types-75ngdNZa.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-JKS5PF2Y.js.map +0 -1
- package/dist/chunk-XO56R4TD.cjs.map +0 -1
- package/dist/process-O5CGWUU7.js +0 -7
- package/dist/process-UCPFMQ6X.cjs +0 -7
- /package/dist/{chunk-PI5TLKE3.js.map → chunk-HGTGVVB5.js.map} +0 -0
- /package/dist/{process-O5CGWUU7.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
|
|
4
|
-
require('../../chunk-
|
|
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
|
|
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
|
|
18
|
+
return _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "public");
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk2WP6WC4Icjs = require('../../chunk-2WP6WC4I.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
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 =
|
|
16
|
+
processingPromise = _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, vazaConfig, "public");
|
|
17
17
|
processingPromise.catch((err) => {
|
|
18
|
-
|
|
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
|
|
30
|
+
return _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "public");
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
processAndWriteOutputs
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-HGTGVVB5.js";
|
|
4
4
|
import {
|
|
5
5
|
logger
|
|
6
|
-
} from "../../chunk-
|
|
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
|
|
4
|
-
require('../../chunk-
|
|
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
|
|
11
|
+
await _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "public");
|
|
12
12
|
});
|
|
13
13
|
} else {
|
|
14
|
-
await
|
|
14
|
+
await _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "public");
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
async function buildVazaContent(config) {
|
|
19
|
-
return
|
|
19
|
+
return _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "public");
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
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
|
|
14
|
+
await _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "static");
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
async function buildVazaContent(config) {
|
|
19
|
-
return
|
|
19
|
+
return _chunk2WP6WC4Icjs.processAndWriteOutputs.call(void 0, config, "static");
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkSP3ZSAOUcjs = require('./chunk-SP3ZSAOU.cjs');
|
|
9
9
|
|
|
10
10
|
// src/adapters/shared.ts
|
|
11
11
|
var _fs = require('fs');
|
|
12
12
|
var _path = require('path');
|
|
13
13
|
async function processAndWriteOutputs(config, publicDir) {
|
|
14
|
-
const output = await
|
|
14
|
+
const output = await _chunkSP3ZSAOUcjs.processCollections.call(void 0, config);
|
|
15
15
|
const outDir = ".vaza-content";
|
|
16
16
|
const siteUrl = config.site.url.replace(/\/$/, "");
|
|
17
17
|
ensureDir(outDir);
|
|
@@ -19,13 +19,13 @@ async function processAndWriteOutputs(config, publicDir) {
|
|
|
19
19
|
if (_optionalChain([config, 'access', _ => _.sitemap, 'optionalAccess', _2 => _2.enabled]) !== false) {
|
|
20
20
|
writeJson(_path.join.call(void 0, outDir, "sitemap-data.json"), output.sitemap);
|
|
21
21
|
if (_optionalChain([config, 'access', _3 => _3.sitemap, 'optionalAccess', _4 => _4.splitByCollection])) {
|
|
22
|
-
const groups =
|
|
22
|
+
const groups = _chunkSP3ZSAOUcjs.splitSitemapByCollection.call(void 0, output.sitemap, output.entries);
|
|
23
23
|
const sitemapDir = _path.join.call(void 0, publicDir, "sitemap");
|
|
24
24
|
ensureDir(sitemapDir);
|
|
25
25
|
const indexEntries = [];
|
|
26
26
|
for (const [collection, entries] of groups) {
|
|
27
27
|
const filename = `${collection}.xml`;
|
|
28
|
-
const xml =
|
|
28
|
+
const xml = _chunkSP3ZSAOUcjs.renderSitemapXml.call(void 0, entries, output.hreflang);
|
|
29
29
|
_fs.writeFileSync.call(void 0, _path.join.call(void 0, sitemapDir, filename), xml, "utf-8");
|
|
30
30
|
const lastmod = entries.reduce((latest, e) => {
|
|
31
31
|
if (!e.lastmod) return latest;
|
|
@@ -36,15 +36,15 @@ async function processAndWriteOutputs(config, publicDir) {
|
|
|
36
36
|
...lastmod && { lastmod }
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
const indexXml =
|
|
39
|
+
const indexXml = _chunkSP3ZSAOUcjs.renderSitemapIndex.call(void 0, indexEntries);
|
|
40
40
|
_fs.writeFileSync.call(void 0, _path.join.call(void 0, publicDir, "sitemap.xml"), indexXml, "utf-8");
|
|
41
41
|
} else {
|
|
42
|
-
const xml =
|
|
42
|
+
const xml = _chunkSP3ZSAOUcjs.renderSitemapXml.call(void 0, output.sitemap, output.hreflang);
|
|
43
43
|
_fs.writeFileSync.call(void 0, _path.join.call(void 0, publicDir, "sitemap.xml"), xml, "utf-8");
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
if (_optionalChain([config, 'access', _5 => _5.rss, 'optionalAccess', _6 => _6.enabled]) !== false) {
|
|
47
|
-
const xml =
|
|
47
|
+
const xml = _chunkSP3ZSAOUcjs.renderRssXml.call(void 0, output.rss, config);
|
|
48
48
|
const rssPath = _nullishCoalesce(_optionalChain([config, 'access', _7 => _7.rss, 'optionalAccess', _8 => _8.path]), () => ( "/rss.xml"));
|
|
49
49
|
const rssFile = _path.join.call(void 0, publicDir, rssPath.replace(/^\//, ""));
|
|
50
50
|
ensureDir(_path.dirname.call(void 0, rssFile));
|
|
@@ -92,8 +92,8 @@ async function processAndWriteOutputs(config, publicDir) {
|
|
|
92
92
|
writeJson(_path.join.call(void 0, outDir, "integrity-report.json"), output.integrity);
|
|
93
93
|
const slugManifest = output.entries.map((e) => e.slug);
|
|
94
94
|
writeJson(_path.join.call(void 0, outDir, "slugs.json"), slugManifest);
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
_chunkSP3ZSAOUcjs.logger.info(`Generated ${output.entries.length} entries`);
|
|
96
|
+
_chunkSP3ZSAOUcjs.logger.info(`Outputs written to ${outDir}/ and ${publicDir}/`);
|
|
97
97
|
return output;
|
|
98
98
|
}
|
|
99
99
|
function ensureDir(dir) {
|
|
@@ -109,4 +109,4 @@ function writeJson(path, data) {
|
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
exports.processAndWriteOutputs = processAndWriteOutputs;
|
|
112
|
-
//# sourceMappingURL=chunk-
|
|
112
|
+
//# sourceMappingURL=chunk-2WP6WC4I.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/mehdi/vaza-content/dist/chunk-
|
|
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
|
|
50
|
+
for (const locale of validLocales) {
|
|
11
51
|
const basePath = locale.basePath.replace(/\/$/, "");
|
|
12
52
|
links.push({
|
|
13
53
|
lang: locale.lang,
|
|
@@ -552,36 +592,6 @@ var OG_IMAGE_WIDTH = 1200;
|
|
|
552
592
|
var OG_IMAGE_HEIGHT = 630;
|
|
553
593
|
var OG_IMAGE_CONCURRENCY = 5;
|
|
554
594
|
|
|
555
|
-
// src/logger.ts
|
|
556
|
-
var LEVELS = {
|
|
557
|
-
silent: 0,
|
|
558
|
-
error: 1,
|
|
559
|
-
warn: 2,
|
|
560
|
-
info: 3,
|
|
561
|
-
debug: 4
|
|
562
|
-
};
|
|
563
|
-
var currentLevel = "info";
|
|
564
|
-
function setLogLevel(level) {
|
|
565
|
-
currentLevel = level;
|
|
566
|
-
}
|
|
567
|
-
function shouldLog(level) {
|
|
568
|
-
return LEVELS[level] <= LEVELS[currentLevel];
|
|
569
|
-
}
|
|
570
|
-
var logger = {
|
|
571
|
-
error(...args) {
|
|
572
|
-
if (shouldLog("error")) console.error("[vaza-content]", ...args);
|
|
573
|
-
},
|
|
574
|
-
warn(...args) {
|
|
575
|
-
if (shouldLog("warn")) console.warn("[vaza-content]", ...args);
|
|
576
|
-
},
|
|
577
|
-
info(...args) {
|
|
578
|
-
if (shouldLog("info")) console.log("[vaza-content]", ...args);
|
|
579
|
-
},
|
|
580
|
-
debug(...args) {
|
|
581
|
-
if (shouldLog("debug")) console.log("[vaza-content] [debug]", ...args);
|
|
582
|
-
}
|
|
583
|
-
};
|
|
584
|
-
|
|
585
595
|
// src/utils/concurrency.ts
|
|
586
596
|
async function pMap(items, fn, concurrency) {
|
|
587
597
|
const results = new Array(items.length);
|
|
@@ -708,8 +718,13 @@ async function loadFont(config) {
|
|
|
708
718
|
logger.debug("Inter font cached");
|
|
709
719
|
return arrayBuffer;
|
|
710
720
|
} catch (err) {
|
|
711
|
-
logger.
|
|
712
|
-
|
|
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
|
+
);
|
|
713
728
|
}
|
|
714
729
|
}
|
|
715
730
|
async function loadTemplate(template) {
|
|
@@ -1144,9 +1159,8 @@ function renderSitemapXml(entries, hreflang) {
|
|
|
1144
1159
|
children.push(el("image:image", imgChildren));
|
|
1145
1160
|
}
|
|
1146
1161
|
}
|
|
1147
|
-
if (hasHreflang) {
|
|
1148
|
-
const
|
|
1149
|
-
const links = slug && hreflang ? hreflang[slug] : void 0;
|
|
1162
|
+
if (hasHreflang && hreflang) {
|
|
1163
|
+
const links = findHreflangLinks(entry.loc, hreflang);
|
|
1150
1164
|
if (links) {
|
|
1151
1165
|
for (const link of links) {
|
|
1152
1166
|
children.push({
|
|
@@ -1165,9 +1179,16 @@ function renderSitemapXml(entries, hreflang) {
|
|
|
1165
1179
|
});
|
|
1166
1180
|
return renderXmlDocument(el("urlset", attrs, urlNodes));
|
|
1167
1181
|
}
|
|
1168
|
-
function
|
|
1169
|
-
const
|
|
1170
|
-
|
|
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;
|
|
1171
1192
|
}
|
|
1172
1193
|
function renderSitemapIndex(sitemaps) {
|
|
1173
1194
|
const root = el(
|
|
@@ -1206,6 +1227,7 @@ function generateTaxonomy(entries, _config) {
|
|
|
1206
1227
|
if (entry.tags) {
|
|
1207
1228
|
for (const tag of entry.tags) {
|
|
1208
1229
|
const normalized = tag.toLowerCase().trim();
|
|
1230
|
+
if (!normalized) continue;
|
|
1209
1231
|
if (!tags[normalized]) {
|
|
1210
1232
|
tags[normalized] = [];
|
|
1211
1233
|
}
|
|
@@ -1214,10 +1236,12 @@ function generateTaxonomy(entries, _config) {
|
|
|
1214
1236
|
}
|
|
1215
1237
|
if (entry.category) {
|
|
1216
1238
|
const normalized = entry.category.toLowerCase().trim();
|
|
1217
|
-
if (
|
|
1218
|
-
categories[normalized]
|
|
1239
|
+
if (normalized) {
|
|
1240
|
+
if (!categories[normalized]) {
|
|
1241
|
+
categories[normalized] = [];
|
|
1242
|
+
}
|
|
1243
|
+
categories[normalized].push(entry.slug);
|
|
1219
1244
|
}
|
|
1220
|
-
categories[normalized].push(entry.slug);
|
|
1221
1245
|
}
|
|
1222
1246
|
}
|
|
1223
1247
|
return { tags, categories };
|
|
@@ -1517,6 +1541,7 @@ async function generateBlurPlaceholder(imagePath) {
|
|
|
1517
1541
|
const buffer = await sharp(imagePath).resize(8, 8, { fit: "inside" }).blur().png().toBuffer();
|
|
1518
1542
|
return `data:image/png;base64,${buffer.toString("base64")}`;
|
|
1519
1543
|
} catch {
|
|
1544
|
+
logger.debug(`Could not generate blur placeholder: "${imagePath}"`);
|
|
1520
1545
|
return void 0;
|
|
1521
1546
|
}
|
|
1522
1547
|
}
|
|
@@ -1551,8 +1576,10 @@ async function getImageDimensions(imagePath) {
|
|
|
1551
1576
|
if (metadata.width && metadata.height) {
|
|
1552
1577
|
return { width: metadata.width, height: metadata.height };
|
|
1553
1578
|
}
|
|
1579
|
+
logger.debug(`Image dimensions incomplete for "${imagePath}"`);
|
|
1554
1580
|
return void 0;
|
|
1555
1581
|
} catch {
|
|
1582
|
+
logger.debug(`Could not read image dimensions: "${imagePath}"`);
|
|
1556
1583
|
return void 0;
|
|
1557
1584
|
}
|
|
1558
1585
|
}
|
|
@@ -1746,13 +1773,13 @@ export {
|
|
|
1746
1773
|
DEFAULT_SITEMAP_PRIORITY,
|
|
1747
1774
|
DEFAULT_SITEMAP_CHANGE_FREQ,
|
|
1748
1775
|
generateBreadcrumbs,
|
|
1776
|
+
setLogLevel,
|
|
1777
|
+
logger,
|
|
1749
1778
|
generateHreflang,
|
|
1750
1779
|
generateJsonLd,
|
|
1751
1780
|
generateWebSiteSchema,
|
|
1752
1781
|
generateLinkingSuggestions,
|
|
1753
1782
|
generateMetaTags,
|
|
1754
|
-
setLogLevel,
|
|
1755
|
-
logger,
|
|
1756
1783
|
generateOgImages,
|
|
1757
1784
|
detectRedirects,
|
|
1758
1785
|
generateRobots,
|
|
@@ -1767,4 +1794,4 @@ export {
|
|
|
1767
1794
|
normalize2 as normalize,
|
|
1768
1795
|
processCollections
|
|
1769
1796
|
};
|
|
1770
|
-
//# sourceMappingURL=chunk-
|
|
1797
|
+
//# sourceMappingURL=chunk-GEINM3H6.js.map
|