@site-index/core 0.1.2 → 0.1.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.
@@ -5,7 +5,7 @@ function renderRobotsTxt(siteUrl, disallowedPaths) {
5
5
  lines.push(`Disallow: ${path}`);
6
6
  }
7
7
  lines.push(`Sitemap: ${siteUrl}/sitemap.xml`);
8
- return lines.join("\n");
8
+ return `${lines.join("\n")}\n`;
9
9
  }
10
10
  export function makeRobotsArtifact(siteIndexes, siteUrl) {
11
11
  const disallowed = siteIndexes
@@ -24,7 +24,7 @@ function renderSitemapXml(siteIndexes, siteUrl) {
24
24
  lines.push(" </url>");
25
25
  }
26
26
  lines.push("</urlset>");
27
- return lines.join("\n");
27
+ return `${lines.join("\n")}\n`;
28
28
  }
29
29
  export function makeSitemapArtifacts(sitemaps, siteUrl) {
30
30
  const sortedSitemaps = [...sitemaps.entries()].toSorted(([a], [b]) => a.localeCompare(b));
@@ -39,11 +39,12 @@ function renderSitemapIndexXml(paths, siteUrl) {
39
39
  `<sitemapindex xmlns="${SITEMAP_XML_NAMESPACE}">`,
40
40
  ];
41
41
  for (const path of paths) {
42
- const loc = escapeXml(`${siteUrl}${path}`);
42
+ const normalizedPath = path.replace(/^\/+/, "");
43
+ const loc = escapeXml(`${siteUrl}/${normalizedPath}`);
43
44
  lines.push(" <sitemap>", ` <loc>${loc}</loc>`, " </sitemap>");
44
45
  }
45
46
  lines.push("</sitemapindex>");
46
- return lines.join("\n");
47
+ return `${lines.join("\n")}\n`;
47
48
  }
48
49
  export function makeSitemapIndexArtifact(sitemaps, siteUrl) {
49
50
  const paths = sitemaps
@@ -1,7 +1,7 @@
1
1
  import { z as Zod } from "zod";
2
2
  import type { LoadModule, Options } from "./types.js";
3
3
  declare const OptionsSchema: Zod.ZodObject<{
4
- siteUrl: Zod.ZodPipe<Zod.ZodURL, Zod.ZodTransform<string, string>>;
4
+ siteUrl: Zod.ZodPreprocess<Zod.ZodPipe<Zod.ZodURL, Zod.ZodTransform<string, string>>>;
5
5
  rootPath: Zod.ZodString;
6
6
  extensions: Zod.ZodDefault<Zod.ZodOptional<Zod.ZodArray<Zod.ZodString>>>;
7
7
  loadModule: Zod.ZodCustom<LoadModule, LoadModule>;
@@ -1,9 +1,9 @@
1
1
  import { z as Zod } from "zod";
2
2
  const OptionsSchema = Zod.object({
3
- siteUrl: Zod.url({
3
+ siteUrl: Zod.preprocess((value) => (typeof value === "string" ? value.trim() : value), Zod.url({
4
4
  protocol: /^https?$/,
5
5
  hostname: Zod.regexes.domain,
6
- }).transform((url) => url.trim().replace(/\/+$/, "")),
6
+ }).transform((url) => url.replace(/\/+$/, ""))),
7
7
  rootPath: Zod.string().trim().min(1),
8
8
  extensions: Zod.array(Zod.string().regex(/^\.\w+$/))
9
9
  .optional()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@site-index/core",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Deterministic site-index pipeline: config, discovery, loading, validation, and artifact generation.",
5
5
  "keywords": [
6
6
  "site-index",