vaza-content 0.3.0 → 0.3.1
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-UCWY7BIM.js → chunk-ENRQYMG7.js} +115 -52
- package/dist/chunk-ENRQYMG7.js.map +1 -0
- package/dist/{chunk-42BZQUA7.js → chunk-HRA5O4XV.js} +3 -3
- package/dist/chunk-HRA5O4XV.js.map +1 -0
- package/dist/{chunk-QJYWBJE2.cjs → chunk-WMZ2V72R.cjs} +7 -7
- package/dist/chunk-WMZ2V72R.cjs.map +1 -0
- package/dist/{chunk-NHCLSSMK.cjs → chunk-XPYCZ2EO.cjs} +115 -52
- package/dist/chunk-XPYCZ2EO.cjs.map +1 -0
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +3 -7
- package/dist/index.d.ts +3 -7
- package/dist/index.js +1 -1
- package/dist/process-BDNNMA6J.js +7 -0
- package/dist/process-REDRQRT4.cjs +7 -0
- package/dist/{process-K3PJFLUV.cjs.map → process-REDRQRT4.cjs.map} +1 -1
- package/dist/{types-CtC0JyA4.d.cts → types-DEtt_e1a.d.cts} +1 -1
- package/dist/{types-CtC0JyA4.d.ts → types-DEtt_e1a.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-42BZQUA7.js.map +0 -1
- package/dist/chunk-NHCLSSMK.cjs.map +0 -1
- package/dist/chunk-QJYWBJE2.cjs.map +0 -1
- package/dist/chunk-UCWY7BIM.js.map +0 -1
- package/dist/process-K3PJFLUV.cjs +0 -7
- package/dist/process-XS6U5TCT.js +0 -7
- /package/dist/{process-XS6U5TCT.js.map → process-BDNNMA6J.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 _chunkWMZ2V72Rcjs = require('../../chunk-WMZ2V72R.cjs');
|
|
4
|
+
require('../../chunk-XPYCZ2EO.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 _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, config, "public");
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
async function buildVazaContent(config) {
|
|
18
|
-
return
|
|
18
|
+
return _chunkWMZ2V72Rcjs.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 _chunkWMZ2V72Rcjs = require('../../chunk-WMZ2V72R.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkXPYCZ2EOcjs = require('../../chunk-XPYCZ2EO.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 = _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, vazaConfig, "public");
|
|
17
17
|
processingPromise.catch((err) => {
|
|
18
|
-
|
|
18
|
+
_chunkXPYCZ2EOcjs.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 _chunkWMZ2V72Rcjs.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-HRA5O4XV.js";
|
|
4
4
|
import {
|
|
5
5
|
logger
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-ENRQYMG7.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 _chunkWMZ2V72Rcjs = require('../../chunk-WMZ2V72R.cjs');
|
|
4
|
+
require('../../chunk-XPYCZ2EO.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 _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, config, "public");
|
|
12
12
|
});
|
|
13
13
|
} else {
|
|
14
|
-
await
|
|
14
|
+
await _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, config, "public");
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
async function buildVazaContent(config) {
|
|
19
|
-
return
|
|
19
|
+
return _chunkWMZ2V72Rcjs.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 _chunkWMZ2V72Rcjs = require('../../chunk-WMZ2V72R.cjs');
|
|
4
|
+
require('../../chunk-XPYCZ2EO.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 _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, config, "static");
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
async function buildVazaContent(config) {
|
|
19
|
-
return
|
|
19
|
+
return _chunkWMZ2V72Rcjs.processAndWriteOutputs.call(void 0, config, "static");
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
|
|
@@ -921,6 +921,45 @@ function generateRobots(config) {
|
|
|
921
921
|
return lines.join("\n");
|
|
922
922
|
}
|
|
923
923
|
|
|
924
|
+
// src/utils/xml.ts
|
|
925
|
+
function escapeXml(str) {
|
|
926
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g, "");
|
|
927
|
+
}
|
|
928
|
+
function renderXml(node, indent = 0) {
|
|
929
|
+
const pad = " ".repeat(indent);
|
|
930
|
+
const attrs = renderAttrs(node.attrs);
|
|
931
|
+
if (node.selfClose || !node.children || node.children.length === 0) {
|
|
932
|
+
return `${pad}<${node.tag}${attrs} />`;
|
|
933
|
+
}
|
|
934
|
+
if (node.children.length === 1 && typeof node.children[0] === "string") {
|
|
935
|
+
return `${pad}<${node.tag}${attrs}>${escapeXml(node.children[0])}</${node.tag}>`;
|
|
936
|
+
}
|
|
937
|
+
const lines = [`${pad}<${node.tag}${attrs}>`];
|
|
938
|
+
for (const child of node.children) {
|
|
939
|
+
if (typeof child === "string") {
|
|
940
|
+
lines.push(`${" ".repeat(indent + 1)}${escapeXml(child)}`);
|
|
941
|
+
} else {
|
|
942
|
+
lines.push(renderXml(child, indent + 1));
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
lines.push(`${pad}</${node.tag}>`);
|
|
946
|
+
return lines.join("\n");
|
|
947
|
+
}
|
|
948
|
+
function renderXmlDocument(root) {
|
|
949
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
950
|
+
${renderXml(root)}`;
|
|
951
|
+
}
|
|
952
|
+
function renderAttrs(attrs) {
|
|
953
|
+
if (!attrs || Object.keys(attrs).length === 0) return "";
|
|
954
|
+
return Object.entries(attrs).map(([key, value]) => ` ${key}="${escapeXml(value)}"`).join("");
|
|
955
|
+
}
|
|
956
|
+
function el(tag, attrsOrChildren, children) {
|
|
957
|
+
if (Array.isArray(attrsOrChildren)) {
|
|
958
|
+
return { tag, children: attrsOrChildren };
|
|
959
|
+
}
|
|
960
|
+
return { tag, attrs: attrsOrChildren, children };
|
|
961
|
+
}
|
|
962
|
+
|
|
924
963
|
// src/generate/rss.ts
|
|
925
964
|
function generateRss(entries, config) {
|
|
926
965
|
const siteUrl = config.site.url.replace(/\/$/, "");
|
|
@@ -944,41 +983,46 @@ function generateRss(entries, config) {
|
|
|
944
983
|
}
|
|
945
984
|
function renderRssXml(items, config) {
|
|
946
985
|
const siteUrl = config.site.url.replace(/\/$/, "");
|
|
947
|
-
const
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
"
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
` <description>${escapeXml(config.site.description ?? "")}</description>`,
|
|
954
|
-
` <language>${config.site.language ?? "en"}</language>`,
|
|
955
|
-
` <lastBuildDate>${(/* @__PURE__ */ new Date()).toUTCString()}</lastBuildDate>`
|
|
986
|
+
const channelChildren = [
|
|
987
|
+
el("title", [config.site.name]),
|
|
988
|
+
el("link", [siteUrl]),
|
|
989
|
+
el("description", [config.site.description ?? ""]),
|
|
990
|
+
el("language", [config.site.language ?? "en"]),
|
|
991
|
+
el("lastBuildDate", [(/* @__PURE__ */ new Date()).toUTCString()])
|
|
956
992
|
];
|
|
957
993
|
if (config.rss?.path) {
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
994
|
+
channelChildren.push({
|
|
995
|
+
tag: "atom:link",
|
|
996
|
+
attrs: {
|
|
997
|
+
href: siteUrl + config.rss.path,
|
|
998
|
+
rel: "self",
|
|
999
|
+
type: "application/rss+xml"
|
|
1000
|
+
},
|
|
1001
|
+
selfClose: true
|
|
1002
|
+
});
|
|
961
1003
|
}
|
|
962
1004
|
for (const item of items) {
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
lines.push(` <guid isPermaLink="true">${escapeXml(item.guid)}</guid>`);
|
|
1005
|
+
const itemChildren = [
|
|
1006
|
+
el("title", [item.title]),
|
|
1007
|
+
el("link", [item.link]),
|
|
1008
|
+
el("description", [item.description]),
|
|
1009
|
+
el("pubDate", [item.pubDate]),
|
|
1010
|
+
el("guid", { isPermaLink: "true" }, [item.guid])
|
|
1011
|
+
];
|
|
971
1012
|
if (item.author) {
|
|
972
|
-
|
|
1013
|
+
itemChildren.push(el("author", [item.author]));
|
|
973
1014
|
}
|
|
974
|
-
|
|
1015
|
+
channelChildren.push(el("item", itemChildren));
|
|
975
1016
|
}
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
1017
|
+
const rss = {
|
|
1018
|
+
tag: "rss",
|
|
1019
|
+
attrs: {
|
|
1020
|
+
version: "2.0",
|
|
1021
|
+
"xmlns:atom": "http://www.w3.org/2005/Atom"
|
|
1022
|
+
},
|
|
1023
|
+
children: [el("channel", channelChildren)]
|
|
1024
|
+
};
|
|
1025
|
+
return renderXmlDocument(rss);
|
|
982
1026
|
}
|
|
983
1027
|
|
|
984
1028
|
// src/generate/sitemap.ts
|
|
@@ -1021,43 +1065,62 @@ function generateSitemap(entries, config) {
|
|
|
1021
1065
|
}
|
|
1022
1066
|
return sitemapEntries;
|
|
1023
1067
|
}
|
|
1024
|
-
function renderSitemapXml(entries) {
|
|
1068
|
+
function renderSitemapXml(entries, hreflang) {
|
|
1025
1069
|
const hasImages = entries.some((e) => e.images && e.images.length > 0);
|
|
1026
|
-
const
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1070
|
+
const hasHreflang = hreflang && Object.keys(hreflang).length > 0;
|
|
1071
|
+
const attrs = {
|
|
1072
|
+
xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9"
|
|
1073
|
+
};
|
|
1074
|
+
if (hasImages) {
|
|
1075
|
+
attrs["xmlns:image"] = "http://www.google.com/schemas/sitemap-image/1.1";
|
|
1076
|
+
}
|
|
1077
|
+
if (hasHreflang) {
|
|
1078
|
+
attrs["xmlns:xhtml"] = "http://www.w3.org/1999/xhtml";
|
|
1079
|
+
}
|
|
1080
|
+
const urlNodes = entries.map((entry) => {
|
|
1081
|
+
const children = [el("loc", [entry.loc])];
|
|
1033
1082
|
if (entry.lastmod) {
|
|
1034
|
-
|
|
1083
|
+
children.push(el("lastmod", [entry.lastmod]));
|
|
1035
1084
|
}
|
|
1036
1085
|
if (entry.changefreq) {
|
|
1037
|
-
|
|
1086
|
+
children.push(el("changefreq", [entry.changefreq]));
|
|
1038
1087
|
}
|
|
1039
1088
|
if (entry.priority !== void 0) {
|
|
1040
|
-
|
|
1089
|
+
children.push(el("priority", [String(entry.priority)]));
|
|
1041
1090
|
}
|
|
1042
1091
|
if (entry.images) {
|
|
1043
1092
|
for (const img of entry.images) {
|
|
1044
|
-
|
|
1045
|
-
lines.push(` <image:loc>${escapeXml2(img.loc)}</image:loc>`);
|
|
1093
|
+
const imgChildren = [el("image:loc", [img.loc])];
|
|
1046
1094
|
if (img.title) {
|
|
1047
|
-
|
|
1048
|
-
` <image:title>${escapeXml2(img.title)}</image:title>`
|
|
1049
|
-
);
|
|
1095
|
+
imgChildren.push(el("image:title", [img.title]));
|
|
1050
1096
|
}
|
|
1051
|
-
|
|
1097
|
+
children.push(el("image:image", imgChildren));
|
|
1052
1098
|
}
|
|
1053
1099
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1100
|
+
if (hasHreflang) {
|
|
1101
|
+
const slug = extractSlugFromUrl(entry.loc);
|
|
1102
|
+
const links = slug && hreflang ? hreflang[slug] : void 0;
|
|
1103
|
+
if (links) {
|
|
1104
|
+
for (const link of links) {
|
|
1105
|
+
children.push({
|
|
1106
|
+
tag: "xhtml:link",
|
|
1107
|
+
attrs: {
|
|
1108
|
+
rel: "alternate",
|
|
1109
|
+
hreflang: link.lang,
|
|
1110
|
+
href: link.href
|
|
1111
|
+
},
|
|
1112
|
+
selfClose: true
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
return el("url", children);
|
|
1118
|
+
});
|
|
1119
|
+
return renderXmlDocument(el("urlset", attrs, urlNodes));
|
|
1058
1120
|
}
|
|
1059
|
-
function
|
|
1060
|
-
|
|
1121
|
+
function extractSlugFromUrl(url) {
|
|
1122
|
+
const parts = url.split("/").filter(Boolean);
|
|
1123
|
+
return parts[parts.length - 1];
|
|
1061
1124
|
}
|
|
1062
1125
|
|
|
1063
1126
|
// src/generate/taxonomy.ts
|
|
@@ -1627,4 +1690,4 @@ export {
|
|
|
1627
1690
|
normalize2 as normalize,
|
|
1628
1691
|
processCollections
|
|
1629
1692
|
};
|
|
1630
|
-
//# sourceMappingURL=chunk-
|
|
1693
|
+
//# sourceMappingURL=chunk-ENRQYMG7.js.map
|