mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
[ci] format
This commit is contained in:
parent
facfc4682f
commit
9532d56b50
3 changed files with 37 additions and 32 deletions
|
@ -1,4 +1,4 @@
|
||||||
import type { SitemapOptions, SitemapItem } from './index';
|
import type { SitemapItem, SitemapOptions } from './index';
|
||||||
import { parseUrl } from './utils/parse-url';
|
import { parseUrl } from './utils/parse-url';
|
||||||
|
|
||||||
const STATUS_CODE_PAGE_REGEXP = /\/[0-9]{3}\/?$/;
|
const STATUS_CODE_PAGE_REGEXP = /\/[0-9]{3}\/?$/;
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
import type { AstroConfig, AstroIntegration } from 'astro';
|
import type { AstroConfig, AstroIntegration } from 'astro';
|
||||||
import { LinkItem as LinkItemBase, simpleSitemapAndIndex, SitemapItemLoose, EnumChangefreq } from 'sitemap';
|
import {
|
||||||
|
EnumChangefreq,
|
||||||
|
LinkItem as LinkItemBase,
|
||||||
|
simpleSitemapAndIndex,
|
||||||
|
SitemapItemLoose,
|
||||||
|
} from 'sitemap';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import { ZodError } from 'zod';
|
import { ZodError } from 'zod';
|
||||||
|
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
import { z } from 'zod';
|
|
||||||
import { EnumChangefreq as ChangeFreq } from 'sitemap';
|
import { EnumChangefreq as ChangeFreq } from 'sitemap';
|
||||||
|
import { z } from 'zod';
|
||||||
import { SITEMAP_CONFIG_DEFAULTS } from './config-defaults';
|
import { SITEMAP_CONFIG_DEFAULTS } from './config-defaults';
|
||||||
|
|
||||||
const localeKeySchema = z.string().min(1);
|
const localeKeySchema = z.string().min(1);
|
||||||
|
|
||||||
export const SitemapOptionsSchema = z
|
export const SitemapOptionsSchema = z
|
||||||
.object({
|
.object({
|
||||||
filter: z.function().args(z.string()).returns(z.boolean()).optional(),
|
filter: z.function().args(z.string()).returns(z.boolean()).optional(),
|
||||||
customPages: z.string().url().array().optional(),
|
customPages: z.string().url().array().optional(),
|
||||||
canonicalURL: z.string().url().optional(),
|
canonicalURL: z.string().url().optional(),
|
||||||
|
|
||||||
i18n: z
|
i18n: z
|
||||||
.object({
|
.object({
|
||||||
defaultLocale: localeKeySchema,
|
defaultLocale: localeKeySchema,
|
||||||
locales: z.record(
|
locales: z.record(
|
||||||
localeKeySchema,
|
localeKeySchema,
|
||||||
z
|
z
|
||||||
.string()
|
.string()
|
||||||
.min(2)
|
.min(2)
|
||||||
.regex(/^[a-zA-Z\-]+$/gm, {
|
.regex(/^[a-zA-Z\-]+$/gm, {
|
||||||
message: 'Only English alphabet symbols and hyphen allowed',
|
message: 'Only English alphabet symbols and hyphen allowed',
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
.refine((val) => !val || val.locales[val.defaultLocale], {
|
.refine((val) => !val || val.locales[val.defaultLocale], {
|
||||||
message: '`defaultLocale` must exist in `locales` keys',
|
message: '`defaultLocale` must exist in `locales` keys',
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
|
|
||||||
entryLimit: z.number().nonnegative().optional().default(SITEMAP_CONFIG_DEFAULTS.entryLimit),
|
entryLimit: z.number().nonnegative().optional().default(SITEMAP_CONFIG_DEFAULTS.entryLimit),
|
||||||
serialize: z.function().args(z.any()).returns(z.any()).optional(),
|
serialize: z.function().args(z.any()).returns(z.any()).optional(),
|
||||||
|
|
||||||
changefreq: z.nativeEnum(ChangeFreq).optional(),
|
changefreq: z.nativeEnum(ChangeFreq).optional(),
|
||||||
lastmod: z.date().optional(),
|
lastmod: z.date().optional(),
|
||||||
priority: z.number().min(0).max(1).optional(),
|
priority: z.number().min(0).max(1).optional(),
|
||||||
})
|
})
|
||||||
.strict()
|
.strict()
|
||||||
.default(SITEMAP_CONFIG_DEFAULTS);
|
.default(SITEMAP_CONFIG_DEFAULTS);
|
||||||
|
|
Loading…
Reference in a new issue